:root {
    --brand-color: #1677ff; /* 支付宝蓝/政务蓝 */
    --brand-hover: #4096ff;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-main: #1a1a1a;
    --text-sub: #8c8c8c;
    --border-color: #f0f0f0;
    --error-color: #ff4d4f;
}

body {
    margin: 0;
    padding: 0;
    background-color: #eef0f4;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* === 手机外壳 (Phone Frame) === */
.phone-frame {
    width: 375px;
    height: 812px; /* iPhone X 尺寸 */
    background: var(--bg-color);
    border-radius: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    border: 8px solid #111;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* === 状态栏与导航 === */
.status-bar {
    height: 44px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    z-index: 10;
}

.nav-bar {
    height: 44px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; /* 防止被压缩 */
}

.nav-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
}

/* === 核心内容区 (Flex 布局修复 Bug) === */
.app-content {
    flex: 1; /* 占据剩余空间 */
    overflow-y: auto; /* 内容溢出滚动 */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 通用容器样式，解决高度塌陷 */
/* 关键：用于包含 scroll-content 和 fixed-footer */
.page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%; 
}

/* 可滚动的内容区域 */
.scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: var(--bg-color);
}

/* 底部固定区域 (按钮) */
.fixed-footer {
    padding: 15px 20px;
    background: #fff;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    z-index: 5;
    flex-shrink: 0; /* 防止按钮被压缩消失 */
}

/* === 组件 UI 美化 === */

/* 卡片 */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* 宫格菜单 */
.grid-menu {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px 10px;
    padding: 20px 10px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 15px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.grid-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    /* 更加柔和的色彩背景 */
    background: linear-gradient(135deg, #f6f8fb 0%, #e9ecf0 100%);
}

.grid-text {
    font-size: 12px;
    color: #555;
    text-align: center;
}

/* 广告横幅 - 做的像系统通知 */
.banner {
    background: linear-gradient(90deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 12px;
    padding: 15px;
    margin: 15px;
    color: #d4380d;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 10px rgba(252, 182, 159, 0.3);
}

/* 协议文本框 - 陷阱 UI */
.legal-box {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    height: 350px; /* 固定高度，迫使滚动 */
    overflow-y: scroll;
    font-size: 13px;
    color: #666;
    line-height: 1.8;
    border: 1px solid #eee;
    margin-bottom: 15px;
    /* 隐藏滚动条但保留功能 (iOS风格，增加老年人难度) */
    scrollbar-width: thin;
}

/* 按钮 */
.btn {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--brand-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}

.btn-secondary {
    background: #fff;
    color: var(--brand-color);
    border: 1px solid var(--brand-color);
}

.btn-disabled {
    background: #d9d9d9;
    color: #fff;
    cursor: not-allowed;
    box-shadow: none;
}

/* 输入框 (High Fidelity) */
.input-group {
    background: #fff;
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f0f0f0; /* 细微边框 */
}

.input-row {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}
.input-row:last-child {
    border-bottom: none;
}

.input-label {
    width: 90px;
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

.input-field {
    flex: 1;
    border: none;
    font-size: 15px;
    outline: none;
    color: #333;
    background: transparent;
}
.input-field::placeholder { color: #ccc; }

.input-error { color: var(--error-color); }
.error-tip { font-size: 12px; color: var(--error-color); padding: 0 15px 10px; display: none; }

/* 验证码输入框特效 */
.code-input-box {
    display: flex;
    justify-content: space-between;
    margin: 30px 20px;
}
.code-digit {
    width: 50px;
    height: 50px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    text-align: center;
    font-size: 24px;
    line-height: 50px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}
.code-digit:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

/* === 分流选择页样式 === */
.tab-header {
    display: flex;
    background: #fff;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.tab-item {
    padding: 15px 10px;
    margin-right: 20px;
    font-size: 16px;
    color: #666;
    position: relative;
    cursor: pointer;
}

.tab-item.active {
    color: var(--brand-color);
    font-weight: bold;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--brand-color);
}

/* === 新增：开屏广告陷阱 (Splash Ad) === */
.splash-ad-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.ad-image {
    width: 100%;
    flex: 1; /* 撑满剩余空间 */
    /* 使用一个看起来像促销活动的背景 */
    background: url('https://via.placeholder.com/400x700/ff4d4f/ffffff?text=双11返场+点击领取') center/cover;
    position: relative;
    cursor: pointer; /* 诱导点击 */
}

/* 陷阱按钮：极小，半透明，右上角 */
.ad-skip-btn {
    position: absolute;
    top: 50px; /* 避开刘海屏 */
    right: 20px;
    background: rgba(0,0,0,0.3);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.6);
    z-index: 1000;
}

.ad-fake-btn {
    width: 80%;
    height: 50px;
    background: #ff4d4f;
    color: white;
    font-size: 20px;
    border: none;
    border-radius: 25px;
    margin: 20px auto;
    font-weight: bold;
    animation: pulse 1s infinite;
}
@keyframes pulse { 0% {transform: scale(1);} 50% {transform: scale(1.05);} 100% {transform: scale(1);} }

/* 调试面板 */
.debug-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: rgba(0,0,0,0.8);
    color: #0f0;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    z-index: 100;
    display: none; /* 默认隐藏，可手动开启 */
}
@media (min-width: 800px) {
    .debug-panel { display: block; left: 50%; margin-left: 220px; bottom: 50px; }
}


/* === 新增：模拟手机顶部系统通知 (Notification Banner) === */
.sys-notification {
    position: absolute;
    top: -100px; /* 默认隐藏在屏幕上方 */
    left: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px); /* 毛玻璃效果 */
    padding: 12px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 2000; /* 必须最高，覆盖在页面上 */
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性滑入动画 */
    cursor: pointer;
}

.sys-notification.show {
    top: 8px; /* 滑入后的位置 */
}

.notif-icon {
    width: 36px;
    height: 36px;
    background: #4cd964; /* 微信/短信绿 */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.notif-content {
    flex: 1;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.notif-body {
    font-size: 14px;
    color: #000;
    line-height: 1.4;
    font-weight: 500;
}

.face-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
}

/* 模拟摄像头取景框 */
.camera-box {
    width: 240px;
    height: 240px;
    background: #000;
    border-radius: 50%; /* 圆形取景框 */
    border: 4px solid var(--brand-color);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    background-image: url('https://via.placeholder.com/300x300/333333/ffffff?text=用户面部'); 
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

/* 扫描光效 */
.scan-line {
    width: 100%;
    height: 4px;
    background: #0f0;
    position: absolute;
    top: 0;
    animation: scan 1.5s infinite linear;
    box-shadow: 0 0 10px #0f0;
}
@keyframes scan { 0% {top:0} 100% {top:100%} }

/* 动作指令文字 */
.action-instruction {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}
.highlight-text {
    color: var(--brand-color);
    font-size: 26px;
}

/* 选项网格 */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

.action-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s;
    font-weight: 500;
    color: #555;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.action-btn:active {
    background: #f0f0f0;
    transform: scale(0.98);
}

.ocr-camera-container {
    background: #000;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 取景框 */
.viewfinder-box {
    flex: 1;
    margin: 20px;
    border: 2px solid rgba(255,255,255,0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 四个角的准星 */
.viewfinder-box::before, .viewfinder-box::after,
.viewfinder-inner::before, .viewfinder-inner::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border-color: #1677ff;
    border-style: solid;
    transition: all 0.3s;
}
/* 左上 */
.viewfinder-box::before { top: 0; left: 0; border-width: 4px 0 0 4px; }
/* 右上 */
.viewfinder-box::after { top: 0; right: 0; border-width: 4px 4px 0 0; }
/* 内部辅助容器实现左下右下 */
.viewfinder-inner { width: 100%; height: 100%; position: absolute; top:0; left:0; pointer-events: none;}
/* 左下 */
.viewfinder-inner::before { bottom: 0; left: 0; border-width: 0 0 4px 4px; }
/* 右下 */
.viewfinder-inner::after { bottom: 0; right: 0; border-width: 0 4px 4px 0; }

/* 状态指示文字 */
.camera-status {
    position: absolute;
    top: 10px;
    left: 0; right: 0;
    text-align: center;
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 5px;
    font-size: 14px;
    border-radius: 4px;
    width: 120px;
    margin: 0 auto;
}

/* 模拟发票图片 */
.receipt-preview {
    width: 80%;
    height: auto;
    transition: filter 0.3s ease; /* 模糊过渡动画 */
}

/* 底部操作栏 */
.camera-controls {
    height: 120px;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 拍照按钮 */
.shutter-btn {
    width: 70px;
    height: 70px;
    background: #fff;
    border-radius: 50%;
    border: 4px solid #ccc;
    cursor: pointer;
    position: relative;
}
.shutter-btn:active { background: #ddd; transform: scale(0.95); }

/* 提示语 */
.camera-tip {
    position: absolute;
    bottom: 130px;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: 14px;
    text-shadow: 0 1px 2px #000;
}