/* ================= 1. 全局与变量 (Global) ================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;700&display=swap');

:root {
    /* 莫奈/马卡龙配色 */
    --primary: #9ab6c7;       /* 莫奈蓝灰 */
    --secondary: #e6cdbf;     /* 暖沙色 */
    --accent: #f7d794;        /* 柔光黄 */
    --text-main: #5d4037;     /* 深褐 */
    --text-sub: #a1887f;      /* 浅褐 */
    --glass: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.9);
    
    /* 按钮色 */
    --btn-login: #9ab6c7;
    --btn-summon: #ffb8b8;
    --btn-download: #81ecec;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Noto Serif SC', 'PingFang SC', serif;
    height: 100vh; overflow: hidden;
    display: flex; justify-content: center; align-items: center;
    background-color: #f0f2f5;
    perspective: 1500px; /* 增加视距，让3D效果更自然 */
}

/* ================= 2. 背景与装饰 (Background) ================= */

/* 动态模糊背景 */
.monet-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 20%, #ffdad9 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, #d4e4ff 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #fff3cd 0%, transparent 50%),
        linear-gradient(135deg, #fdfbf7 0%, #fff 100%);
    filter: blur(20px);
    animation: bgFlow 10s ease-in-out infinite alternate;
}

@keyframes bgFlow {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* ================= 3. 主容器与3D翻转体系 (修复割裂感的关键) ================= */

.main-container {
    width: 380px; height: 550px;
    position: relative;
    z-index: 10;
}

/* 翻转包裹层：负责统一旋转 */
.flip-wrapper {
    position: relative;
    width: 100%; height: 100%;
    transform-style: preserve-3d; /* 保持3D空间 */
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* 弹性缓动 */
}

/* JS控制这个类名来实现翻转 */
.flip-wrapper.flipped {
    transform: rotateY(180deg);
}

/* 卡片通用样式 */
.magic-card {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05), inset 0 0 20px rgba(255,255,255,0.5);
    display: flex; flex-direction: column;
    padding: 40px 30px;
    
    /* 隐藏背面，防止透视穿帮 */
    backface-visibility: hidden; 
    -webkit-backface-visibility: hidden;
}

/* 正面：登录卡 */
.front-card {
    transform: rotateY(0deg);
    z-index: 2;
}

/* 背面：身份认证卡 */
.back-card {
    transform: rotateY(180deg); /* 预先旋转180度 */
    z-index: 1;
}

/* ================= 4. 内容与排版 (Content) ================= */

.header { text-align: center; margin-bottom: 30px; }
.header h2 { 
    color: var(--text-main); font-size: 28px; font-weight: 700; margin-bottom: 5px; 
    text-shadow: 2px 2px 0px rgba(255,255,255,0.8);
}
.header p { color: var(--text-sub); font-size: 14px; letter-spacing: 1px; }

/* 输入框组 */
.input-group { margin-bottom: 20px; text-align: left; }
.input-group label {
    display: block; color: var(--text-main); font-size: 14px; margin-bottom: 8px; font-weight: bold;
}
.input-group label i { margin-right: 5px; color: var(--primary); }

.input-group input, 
.input-group textarea {
    width: 100%; padding: 12px 15px;
    border: 2px solid transparent; border-radius: 12px;
    background: rgba(255,255,255,0.6);
    font-family: inherit; font-size: 14px; color: var(--text-main);
    transition: all 0.3s ease; outline: none;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.02);
}
.input-group textarea { resize: none; line-height: 1.6; }
.input-group input:focus, .input-group textarea:focus {
    border-color: var(--primary); background: #fff;
    box-shadow: 0 0 10px rgba(154, 182, 199, 0.2);
}

/* 按钮 */
.btn-base {
    width: 100%; padding: 12px; border: none; border-radius: 12px;
    font-family: inherit; font-weight: bold; font-size: 16px;
    cursor: pointer; transition: all 0.2s ease;
    display: flex; justify-content: center; align-items: center; gap: 8px;
    color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}
.btn-base:active { transform: scale(0.98); }

.login-btn { background: var(--btn-login); box-shadow: 0 4px 15px rgba(154, 182, 199, 0.4); }
.login-btn:hover { background: #89a5b8; }

.summon-btn { background: var(--btn-summon); box-shadow: 0 4px 15px rgba(255, 184, 184, 0.4); }
.summon-btn:hover { background: #ffa5a5; }

.download-btn { background: var(--btn-download); margin-bottom: 15px; color: #555; }
.secondary-btn { background: #eee; color: #666; width: 30%; font-size: 14px; text-shadow: none; }
.secondary-btn:hover { background: #ddd; }

.btn-row { display: flex; gap: 10px; }
.btn-row .summon-btn { width: 70%; }

/* 底部链接 */
.footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-sub); }
.footer a { color: var(--primary); text-decoration: none; font-weight: bold; position: relative; }
.footer a::after {
    content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px;
    background: var(--primary); transition: width 0.3s;
}
.footer a:hover::after { width: 100%; }

/* 结果页展示 */
.result-box {
    background: rgba(255,255,255,0.5); border-radius: 12px;
    padding: 15px; margin-bottom: 20px; text-align: center;
    border: 1px dashed var(--text-sub);
}
.result-box h3 { color: var(--primary); margin-bottom: 10px; font-size: 18px; }
.result-box p { font-size: 12px; color: #777; margin-bottom: 15px; }

.info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.05);
}
.info-row span { font-size: 13px; color: var(--text-sub); }
.info-row strong { color: var(--text-main); font-size: 15px; }

.hidden { display: none !important; }

/* ================= 5. 高级轻柔加载特效 (Aurora/Cloud) ================= */

.summon-loading {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1000;
    display: flex; justify-content: center; align-items: center;
    background: #0f1020; /* 深空蓝黑 */
    overflow: hidden;
    opacity: 0; pointer-events: none; /* 默认不可见 */
    transition: opacity 0.5s ease;
}

.summon-loading:not(.hidden) {
    opacity: 1; pointer-events: auto;
}

/* 柔光背景 */
.soft-glow-bg {
    position: absolute; width: 200%; height: 200%;
    background: radial-gradient(circle, #4facfe 0%, #00f2fe 30%, transparent 70%);
    opacity: 0.15;
    filter: blur(60px);
    animation: glowMove 8s infinite alternate;
}

@keyframes glowMove {
    0% { transform: translate(-10%, -10%); }
    100% { transform: translate(10%, 10%); }
}

/* 浮动云雾 */
.floating-clouds {
    position: absolute; width: 100%; height: 100%;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ0cmFuc3BhcmVudCIvPjwvc3ZnPg=='); /* 占位，实际用CSS shadow模拟 */
    box-shadow: 
        0 0 100px 50px rgba(162, 155, 254, 0.1),
        inset 0 0 80px 40px rgba(116, 185, 255, 0.1);
    animation: breathe 4s ease-in-out infinite alternate;
}

@keyframes breathe {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

/* 中间的内容 */
.loading-content {
    position: relative; z-index: 10;
    text-align: center;
}

.prism-spinner {
    width: 60px; height: 60px;
    margin: 0 auto 20px;
    border: 2px solid transparent;
    border-top-color: #a29bfe;
    border-right-color: #74b9ff;
    border-radius: 50%;
    animation: prismSpin 1.5s linear infinite;
    box-shadow: 0 0 15px rgba(162, 155, 254, 0.5);
}

.loading-text {
    color: #fff; font-size: 14px; letter-spacing: 3px; font-weight: 300;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

@keyframes prismSpin { to { transform: rotate(360deg); } }

/* ================= 6. 光点扩散特效 (Light Seed) ================= */

/* 光点种子 */
.light-seed {
    position: absolute;
    top: 50%; left: 50%;
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0); /* 初始不可见 */
    box-shadow: 
        0 0 20px #fff,
        0 0 40px #ffeca0,
        0 0 60px #ffaeae;
    z-index: 2000;
    pointer-events: none;
    transition: transform 0.8s cubic-bezier(0.7, 0, 0.3, 1);
}

/* JS控制这个类，让光点先变大一点，然后爆炸 */
.light-seed.expand-full {
    transform: translate(-50%, -50%) scale(150); /* 放大到覆盖全屏 */
    transition-duration: 1s;
}

/* ================= 7. 身份卡弹窗 (Contract Modal) ================= */

.contract-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(8px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
}

.contract-modal:not(.hidden) {
    opacity: 1; pointer-events: auto;
}

.contract-content {
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.contract-modal:not(.hidden) .contract-content {
    transform: scale(1);
}

.contract-img {
    max-width: 90%; max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3); /* 金色光晕 */
    cursor: pointer;
    transition: transform 0.3s ease;
}

.contract-img:hover { transform: scale(1.02); }

.contract-tip {
    margin-top: 20px; color: rgba(255,255,255,0.7); font-size: 14px; letter-spacing: 2px;
    animation: textPulse 2s infinite;
}

@keyframes textPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }