/**
 * 首页专属样式
 * 包含：首页布局、Loading 层、头像容器、交互按钮、弹窗组件、隐私协议
 *
 * 当前页面引用情况：
 * - index.html
 */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: "Digital Numbers";
    src: url("../Digital%20Numbers.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

body, html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 全局字体粗细修正：将所有"最粗"改为 medium */
strong, b {
    font-weight: 500;
}

/* 环境识别与 Loading 解耦 */
.is-not-wechat-env #loading-screen,
.skip-loading #loading-screen {
    display: none;
}
.is-not-wechat-env #app,
.skip-loading #app {
    display: block;
}

/* 布局控制 */
.background-layer {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    overflow: hidden;
    margin: 0 auto;
}

/* 首页应用容器 (状态0/1专用) */
#app {
    width: 100vw;
    min-height: 100vh;
    overflow: visible;
    position: relative;
}

/* 首页背景图
 * 背景图是2倍切图(828x1932)，实际显示尺寸按414x966计算
 * 保持比例撑满屏幕，固定不随页面滚动，超出部分截断
 */
.main-bg {
    width: 100%;
    height: 100vh;
    object-fit: cover;
    object-position: top;
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

/* 小屏幕手机（高度小于896px）背景图顶部对齐 */
@media screen and (max-height: 896px) {
    .main-bg {
        object-position: top;
        object-fit: cover;
    }
}

/* 历史记录按钮 */
.history-record {
    position: absolute;
    top: 15px;
    left: 0;
    width: 111px;
    height: 36px;
    background: rgba(218, 255, 115, 0.5);
    border-radius: 0 50px 50px 0;
    display: flex;
    align-items: center;
    z-index: 100;
    cursor: pointer;
}

/* 首页上方图片 - 宽度88px(414屏幕)，自适应 */
.index-top-img {
    position: fixed;
    top: 40px;
    right: 30px;
    width: 21.26vw;
    max-width: 88px;
    height: auto;
    z-index: 100;
    display: block;
}

/* 客服按钮 - 位于图片下方20px，右对齐 */
.service-btn {
    position: fixed;
    top: calc(40px + 36.23vw + 20px);
    right: 30px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    z-index: 100;
    -webkit-tap-highlight-color: transparent;
}

.service-btn:active {
    transform: scale(0.95);
    opacity: 0.9;
}

.service-btn-img {
    width: 100%;
    height: 100%;
    display: block;
}

.history-icon {
    width: 12px;
    height: 12px;
    margin-left: 15px;
}

.history-text {
    margin-left: 5px;
    font-size: 3.86vw;
    line-height: 3.86vw;
    color: #3C643A;
}

/* 头像容器 - 正方形，位于付费按钮上方 70px */
#app .avatar-perspective-container {
    position: fixed;
    left: 50%;
    bottom: calc(100px + 30px + 70px + 70px);
    transform: translateX(-50%);
    width: 31.4vw;
    height: 31.4vw;
    max-width: 130px;
    max-height: 130px;
    border-radius: 8px;
    overflow: visible;
    z-index: 5;
    background-color: #f0f0f0;
}

/* 头像发光背景 */
.avatar-perspective-container::before {
    content: '';
    position: absolute;
    left: -20%;
    right: -20%;
    top: -20%;
    bottom: -20%;
    background: linear-gradient(180deg, #FFFDB5 0%, #FFF961 100%);
    filter: blur(14.6809px);
    border-radius: 50px;
    z-index: -1;
}

/* 新标志 - 位于头像右上角（单按钮模式） */
#app .new-badge {
    position: fixed;
    left: calc(50% + 15.7vw - 18px);
    bottom: calc(100px + 30px + 70px + 70px + 31.4vw - 18px);
    width: 36px;
    height: auto;
    z-index: 150;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

/* ============================================
   首页按钮布局（从下到上）
   1. 隐私协议 - 底部
   2. 查看已分析头像按钮 - 隐私协议上方 20px
   3. 付费分析按钮 - 查看按钮上方 30px
   4. 头像 - 付费按钮上方 60px
   ============================================ */

/* 隐私协议 - 固定在底部 60px */
/* 单按钮模式 - 隐私协议底部距离100px */
#app .privacy-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    z-index: 200;
}

/* 按钮基础样式 - 固定定位 */
#app .analysis-btn-wrapper,
#app .check-analyzed-btn-wrapper {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 59.67vw;
    height: 70px;
    transition: transform 0.2s;
    -webkit-tap-highlight-color: transparent;
    z-index: 200;
}

/* 单按钮模式 - 隐私协议底部100px，与按钮间距30px（考虑隐私协议高度约17px） */
#app .analysis-btn-wrapper {
    bottom: calc(100px + 17px + 30px);
}

/* 查看已分析头像按钮 - 默认隐藏 */
#app .check-analyzed-btn-wrapper {
    display: none;
    bottom: calc(100px + 17px + 30px);
}

#app .check-analyzed-btn-wrapper.show {
    display: block;
}

/* 双按钮模式 - 保持原有布局（隐私协议底部60px） */
/* 已分析按钮（下方）在隐私协议上方 30px */
#app.has-check-analyzed-btn .check-analyzed-btn-wrapper {
    bottom: calc(60px + 17px + 30px);
}

/* 付费按钮（上方）在已分析按钮上方 20px */
#app.has-check-analyzed-btn .analysis-btn-wrapper {
    bottom: calc(60px + 17px + 30px + 70px + 20px);
}

/* 双按钮模式下隐私协议保持60px */
#app.has-check-analyzed-btn .privacy-container {
    bottom: 60px;
}

/* 双按钮模式下头像在付费按钮上方 60px */
#app.has-check-analyzed-btn .avatar-perspective-container {
    bottom: calc(60px + 17px + 30px + 70px + 20px + 70px + 60px);
}

/* 双按钮模式下新标志位置 */
#app.has-check-analyzed-btn .new-badge {
    bottom: calc(60px + 17px + 30px + 70px + 20px + 70px + 60px + 31.4vw - 18px);
}

.check-analyzed-btn-img,
.analysis-btn-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.analysis-btn-img {
    filter: drop-shadow(0px 0px 20px rgba(65, 0, 162, 0.2));
}

.is-new-avatar .analysis-btn-img {
    filter: drop-shadow(0px 0px 20px rgba(65, 0, 162, 0.4));
}

.analysis-btn-wrapper:active,
.check-analyzed-btn-wrapper:active {
    transform: translateX(-50%) scale(0.95);
}

.privacy-checkbox {
    width: 12px;
    height: 12px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

/* 未勾选状态 - CSS绘制圆环 */
.privacy-checkbox::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border: 1px solid #888888;
    border-radius: 50%;
    box-sizing: border-box;
}

/* 勾选状态 - 绿色填充圆 */
.privacy-checkbox.checked::before {
    background-color: #54FF9A;
    border: none;
}

/* 勾选图标 - 叠加在圆上方 */
.check-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    pointer-events: none;
}

.privacy-checkbox.checked .check-icon {
    display: block;
}

.privacy-text {
    margin-left: 5px;
    font-size: 2.9vw;
    color: #888888;
    white-space: nowrap;
}

/* 勾选后的文本颜色 */
.privacy-container.checked .privacy-text {
    color: #222222;
}

.protocol-link {
    color: #3167C4;
    font-weight: 500;
    text-decoration: none;
}

/* 隐私协议弹窗内容 */
#privacy-modal .modal-content {
    align-self: flex-end;
    width: 85.5%;
    height: 27.48vh;
    margin-bottom: 9vh;
    background-color: #fff;
    border-radius: 20px;
    border: 3px solid #96FFC9;
    box-shadow: 0 0 10px rgba(150, 255, 201, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0;
}

.modal-title-img {
    height: 18.5%;
    margin-top: calc(27.48vh * 0.1712);
    width: auto;
}

.modal-body-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.38vw;
    color: #222;
    text-align: center;
    padding: 0 20px;
    font-weight: 400;
}

.modal-link {
    color: #00A05D;
    font-weight: 500;
    text-decoration: none;
}

.modal-btn {
    width: 88.7%;
    height: 50px;
    margin-bottom: 20px;
    background-color: #000;
    color: #54ff9a;
    font-size: 3.86vw;
    font-weight: 500;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   初始隐藏元素
   ============================================ */

#wechat-hint {
    color: #fff;
    font-size: 2.9vw;
    margin-top: 10px;
    text-align: center;
    opacity: 0.8;
}

/* ============================================
   微信分享兜底方案样式
   ============================================ */
.wechat-share-fallback {
    margin: 0;
    padding: 0;
    height: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.wechat-share-fallback .wechat-share-img {
    display: block;
}

/* ============================================
   JS 显示控制类
   ============================================ */
#app.show-block,
#loading-screen.show-block,
#history-entry.show-block,
#new-badge.show-block,
#wechat-hint.show-block,
.modal-overlay.show-block,
.toast-container.show-block,
.avatar-inconsistent-modal-overlay.show-block {
    display: block !important;
}

#app.show-flex,
#loading-screen.show-flex,
#history-entry.show-flex,
#new-badge.show-flex,
#wechat-hint.show-flex,
.modal-overlay.show-flex,
.toast-container.show-flex,
.avatar-inconsistent-modal-overlay.show-flex,
.privacy-container.show-flex {
    display: flex !important;
}


/* ============================================
   已分析头像半弹窗样式
   ============================================
   注意：已分析头像弹窗样式统一使用 analyzed-avatar.css
   本文件中已删除重复定义，避免样式冲突
   ============================================ */
