:root {
    --bg-color: #fdfaf6;
    --text-color: #4a4a4a;
    --card-color-1: #e4c9c9;
    --card-color-2: #c7d4c9;
    --card-color-3: #a7b7d0;
    --card-color-4: #e3d9d0;
    --card-color-5: #d4cac2;
    --card-color-6: #c2d4d3;
    --card-color-7: #d2c8e3;
    --card-color-8: #e3d3c8;
    --result-bg-color: #ffffff; 
    --share-bg-color: #f8f9fa;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --shadow-hover-color: rgba(0, 0, 0, 0.12);
    --border-radius: 15px;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    padding-bottom: 150px; /* 为底部固定的分享栏留出足够空间 */
    line-height: 1.6;
}

/* 修正：移除 overflow:hidden，允许结果页滚动 */
body.modal-open {
    /* overflow: hidden; */
}

.container { 
    max-width: 800px; 
    margin: 40px auto; 
    padding: 20px; 
}
header { text-align: center; margin-bottom: 40px; }
header h1 { font-size: 2.5em; margin-bottom: 10px; color: #333; }
header p { font-size: 1.1em; color: #666; }

.test-selection .test-card {
    display: block; text-decoration: none; color: var(--text-color);
    padding: 25px; margin: 20px 0; border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-color);
    transition: all 0.2s ease-in-out;
}
.test-card.color-1 { background-color: var(--card-color-1); }
.test-card.color-2 { background-color: var(--card-color-2); }
.test-card.color-3 { background-color: var(--card-color-3); }
.test-card.color-4 { background-color: var(--card-color-4); }
.test-card.color-5 { background-color: var(--card-color-5); }
.test-card.color-6 { background-color: var(--card-color-6); }
.test-card.color-7 { background-color: var(--card-color-7); }
.test-card.color-8 { background-color: var(--card-color-8); }

.test-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 8px 16px var(--shadow-hover-color); }
.test-card h3 { margin-top: 0; font-size: 1.5em; }
.test-card p { margin-bottom: 0; font-size: 1em; color: #555; }

footer { text-align: center; margin-top: 50px; font-size: 0.9em; color: #999; }
/* 新增：页脚链接样式 */
.footer-links {
    margin-bottom: 15px;
}
.footer-links a {
    color: #777;
    text-decoration: none;
    margin: 0 10px;
}
.footer-links a:hover {
    text-decoration: underline;
}

.test-container { background-color: #fff; padding: 30px 40px; border-radius: var(--border-radius); box-shadow: 0 4px 12px var(--shadow-color); margin-top: 90px; }
.question-block { margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid #eee; }
.question-block:last-child { border-bottom: none; }
.question-block p { font-size: 1.2em; font-weight: bold; margin-bottom: 15px; }
.options label { display: block; padding: 12px; margin: 5px 0; background-color: #f7f7f7; border-radius: 8px; cursor: pointer; transition: all 0.2s; border: 2px solid transparent; }
.options label:hover { background-color: #e9e9e9; border-color: #ccc; }
.options input[type="radio"]:checked + span { font-weight: bold; }
.options input[type="radio"] { margin-right: 10px; }

#submit-btn {
    display: block; width: 100%; padding: 15px; margin-top: 20px;
    font-size: 1.2em; font-weight: bold; color: #fff;
    background-color: #5c7b9a; border: none; border-radius: 8px;
    cursor: pointer; transition: background-color 0.2s;
}
#submit-btn:hover { background-color: #4a637b; }

#result-container {
    background-color: var(--result-bg-color);
    padding: 30px; 
    border-radius: var(--border-radius);
    text-align: center; 
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08); 
    border: 1px solid #eee;
    margin-bottom: 50px;
}
#result-container h2 { font-size: 2em; color: #333; }
#result-container h3 { font-size: 1.5em; color: #4a637b; }
#result-container p { text-align: left; }
.result-disclaimer {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 8px;
    text-align: left;
    font-size: 0.95em;
}

.hidden { display: none; }

/* --- Home Link Button Styles (最终修正版) --- */
.home-link {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #5c7b9a;
    color: #fff !important; /* <--- 最终修正：添加 !important 确保最高优先级 */
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.home-link:hover {
    background-color: #4a637b;
}

/* 专门为静态页面中的“返回首页”按钮增加居中样式 */
.static-page-container .home-link {
    display: table;
    margin: 40px auto 0;
}

.progress-container { 
    position: sticky; top: 0; z-index: 10;
    margin-bottom: 20px; 
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    padding: 15px 20px; 
    border-radius: 10px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
}
#progress-bar-background { width: 100%; background-color: #e0e0e0; border-radius: 10px; overflow: hidden; }
#progress-bar { width: 0%; height: 15px; background-color: #9ab4b1; border-radius: 10px; transition: width 0.3s ease-in-out; }
#progress-text { text-align: center; margin-top: 5px; font-size: 0.9em; color: #555; }

.result-avatar-wrapper { margin-bottom: 20px; display: flex; justify-content: center; }
.avatar-shape {
    width: 120px; height: 120px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    border: 4px solid #fff; display: flex; justify-content: center; align-items: center;
    font-weight: bold; 
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden; position: relative; transform-origin: center center;
    text-shadow: 0 1px 4px rgba(0,0,0,0.25);
    padding: 10px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}
.avatar-shape::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: linear-gradient(-45deg, var(--c1, #ccc), var(--c2, #eee), var(--c1, #ccc), var(--c2, #eee));
    background-size: 400% 400%; 
    animation: gradientFlow 5s ease infinite; 
    z-index: 1;
}
.avatar-shape span { 
    position: relative; 
    z-index: 2;
    font-size: 1.8em;
    line-height: 1.2; 
    text-align: center;
    word-break: normal; 
    max-width: 100%;
}
@keyframes gradientFlow { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* --- 随机形状 Class --- */
.shape-1 { border-radius: 50%; } /* Circle */
.shape-2 { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; } /* Blob 1 */
.shape-3 { border-radius: 20%; transform: rotate(0deg); } /* Rounded Square - 修正为摆正 */
.shape-4 { border-radius: 70% 30% 30% 70% / 60% 40% 60% 40%; } /* Blob 2 */
.shape-5 { border-radius: 15%; transform: rotate(0deg); } /* Rounded Square - 修正为摆正 */


/* --- 新增：头像文字排版样式 --- */
.avatar-shape.chinese-four-chars span {
    font-size: 2.2em; /* 四个汉字使用较大字体 */
    line-height: 1.1; /* 调整行高让两行更紧凑 */
}

.avatar-shape.chinese-long-chars span {
    font-size: 1.6em; /* 超过四个汉字，缩小字体 */
    line-height: 1.1; /* 调整行高让两行更紧凑 */
    padding: 0 5px; /* 增加左右内边距以防文字过长溢出 */
}

.avatar-shape.chinese-single-line span,
.avatar-shape.english-single-line span {
    font-size: 1.8em; /* 预设大小，单行显示 */
    line-height: 1.2;
}

.avatar-shape.english-long-chars span {
    font-size: 1.4em; /* 英文长字符缩小 */
    line-height: 1.2;
    padding: 0 5px;
}


.share-container {
    position: fixed; /* 改为 fixed 定位，使其始终在视口底部 */
    bottom: 0; left: 0; right: 0; z-index: 20;
    background-color: var(--share-bg-color); padding: 15px; text-align: center;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08); border-top: 1px solid #ddd;
}
#result-container .share-container {
    position: static; /* 在结果页中恢复为静态定位 */
    margin-top: 30px; padding: 20px 30px;
    box-shadow: none; border-top: 1px solid #eee;
}
.share-container h3 { color: #6a6a6a; margin-top: 0; margin-bottom: 15px; font-size: 1.1em; }
.share-bar { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.share-btn {
    border: none; padding: 8px 18px; border-radius: 8px; font-size: 0.95em;
    font-weight: bold; color: #fff; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.share-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.share-btn.weibo { background-color: #d37a7a; }
.share-btn.facebook { background-color: #7d9dbe; }
.share-btn.wechat { background-color: #8db59d; }
.share-btn.copy-link { background-color: #a9a9a9; }
.share-btn.create-image { background-color: #83c5be; }

.share-card-container {
    display: none; position: absolute; left: -9999px; top: 0;
    width: 1200px; height: 675px; background-color: var(--bg-color);
    display: flex; font-family: 'Noto Sans SC', sans-serif;
    box-sizing: border-box; overflow: hidden;
}
.share-card-left {
    flex: 2; background-color: #ffffff; padding: 60px;
    display: flex; flex-direction: column; justify-content: center; box-sizing: border-box;
}
.share-avatar-placeholder { text-align: center; margin-bottom: 30px; }
.share-avatar-placeholder .avatar-shape { margin: 0 auto; }
.share-title-placeholder { font-size: 48px; color: #333; text-align: center; margin: 0; }
.share-desc-placeholder { font-size: 22px; color: #555; text-align: left; margin-top: 30px; line-height: 1.7; }
.share-card-right {
    flex: 1; background-color: var(--card-color-4); padding: 50px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center; color: #5c5552; box-sizing: border-box;
}
.share-card-right h3 { font-size: 32px; margin: 0 0 15px 0; line-height: 1.3; }
.share-slogan { font-size: 20px; margin: 0 0 20px 0; line-height: 1.5; }
.share-qrcode-wrapper {
    width: 200px; height: 200px; padding: 10px; background-color: #fff;
    border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border: 5px solid rgba(167, 183, 208, 0.7); display: flex;
    justify-content: center; align-items: center; box-sizing: border-box;
    margin-bottom: 15px; 
}
.share-qrcode-placeholder { 
    width: 100%; height: 100%; display: flex;
    justify-content: center; align-items: center;
}
.share-qrcode-placeholder img { width: 100% !important; height: 100% !important; }
.share-url-placeholder { font-size: 20px; margin-top: 0; font-weight: bold; color: #5c5552; }

/* 新增：静态内容页面样式 */
.static-page-container {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--shadow-color);
    text-align: left;
}
.static-page-container h2 {
    text-align: center;
    margin-bottom: 25px;
}
.static-page-container h3 {
    margin-top: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}
.static-page-container ul {
    padding-left: 20px;
}
.static-page-container a {
    color: #5c7b9a;
    text-decoration: none;
}
.static-page-container a:hover {
    text-decoration: underline;
}

/* --- 新增：图片预览浮层样式 --- */
#image-preview-modal {
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
}
#image-preview-modal .modal-content {
    position: relative;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#image-preview-modal .close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    color: #fff;
    background-color: #333;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 24px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
}
#image-preview-modal .save-instruction {
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}
#image-preview-modal img {
    max-width: 100%;
    max-height: calc(90vh - 100px); /* 确保图片在视口内 */
    border-radius: 5px;
}


@media (max-width: 600px) {
    body { padding: 5px; padding-bottom: 150px; }
    .container { margin: 10px auto; }
    header h1 { font-size: 1.8em; }
    .test-card, #result-container { padding: 20px; }
    .test-container { padding: 20px; margin-top: 80px; }
    .question-block p { font-size: 1.1em; }
    .options label { padding: 10px; }
    #submit-btn { padding: 12px; font-size: 1.1em; }
    .avatar-shape { width: 100px; height: 100px; }
    .avatar-shape span { font-size: 1.6em; }
    #result-container h3 { font-size: 1.3em; }
    #result-container p { font-size: 0.95em; }
    .share-container h3 { font-size: 1em; margin-bottom: 10px;}
    .share-bar { gap: 8px; }
    .share-btn { padding: 8px 12px; font-size: 0.85em; margin-bottom: 5px; }
    .share-bar { gap: 8px; }
    .progress-container { padding: 10px; }
    #progress-bar { height: 12px; }
    #progress-text { font-size: 0.85em; }
    .static-page-container { padding: 20px; }

    /* 移动端头像文字调整 */
    .avatar-shape.chinese-four-chars span {
        font-size: 1.8em; /* 移动端四个汉字略微缩小 */
    }
    .avatar-shape.chinese-long-chars span {
        font-size: 1.3em; /* 移动端超过四个汉字进一步缩小 */
    }
    .avatar-shape.english-long-chars span {
        font-size: 1.1em; /* 移动端英文长字符进一步缩小 */
    }
}