/* ========== 基础动画 ========== */
body {
    animation: fadeIn 1.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 主题变量 ========== */
:root {
    --bg-main: #fff5f8;
    --bg-card: #ffffff;
    --text-color: #2e2a3c;
    --text-light: #8a6b7c;
    --border-color: #ffe6ef;
    --btn-bg: #f0dce6;
    --theme-color: #b34e74;
    --shadow-color: rgba(198, 110, 140, 0.25);
    --tag-bg: #ffe8f0;
    --tag-text: #c46b8b;
    --line-color: #f4a5bc;
    --link-hover-bg: rgba(255, 246, 250, 0.6);
    --qq-blue: #2c6b9e;
    --qq-gold: #e8a735;
}

[data-theme="dark"] {
    --bg-main: #161422;
    --bg-card: #221f33;
    --text-color: #e8e4f0;
    --text-light: #a99cb8;
    --border-color: #383352;
    --btn-bg: #3b304f;
    --theme-color: #f8b8d0;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --tag-bg: #2e2942;
    --tag-text: #e5a0bc;
    --line-color: #7c658c;
    --link-hover-bg: rgba(46, 41, 66, 0.5);
    --qq-blue: #3c7fb0;
}

/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    background: linear-gradient(145deg, var(--bg-main), var(--bg-main));
    font-family: 'Inter', 'Quicksand', sans-serif;
    padding: 20px 16px 80px;
    color: var(--text-color);
}

a:hover,
.test-item:hover {
    background: var(--link-hover-bg);
}

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 12px;
}
::-webkit-scrollbar-thumb {
    background: var(--theme-color);
    border-radius: 12px;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

/* ========== 顶部通知栏 ========== */
.notice-bar {
    max-width: 1000px;
    margin: 0 auto 16px;
    background: var(--bg-card);
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--tag-text);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.notice-text {
    white-space: nowrap;
    animation: scrollNotice 18s linear infinite;
}
@keyframes scrollNotice {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ========== 广告位 ========== */
.ad {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}
.ad a {
    display: block;
}
.ad img {
    display: block;
    width: 100%;
    height: auto;
}
.top-banner-ad {
    max-width: 1000px;
    margin: 0 auto 20px auto;
    border-radius: 20px;
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* ========== 漂浮装饰 ========== */
.floating-deco {
    position: fixed;
    bottom: 15px;
    right: 15px;
    font-size: 32px;
    opacity: 0.15;
    pointer-events: none;
}

/* ========== 介绍卡片 ========== */
.intro-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 18px -6px var(--shadow-color);
}
.intro-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.intro-desc {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-light);
}

/* ========== QQ群卡片 ========== */
.qq-subscribe-card {
    background: var(--bg-card);
    border-radius: 28px;
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 6px 14px var(--shadow-color);
    transition: all 0.2s ease;
}
.qq-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}
.qq-icon-img {
    width: 48px;
    height: 48px;
    border-radius: 28px;
    flex-shrink: 0;
    object-fit: cover;
    background: linear-gradient(145deg, var(--qq-blue), #1f4a6e);
}
.qq-info-area {
    flex: 1;
}
.qq-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 6px;
}
.qq-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.free-badge {
    background: rgba(232, 167, 53, 0.15);
    border-radius: 30px;
    padding: 2px 8px;
    font-size: 9px;
    font-weight: 800;
    color: var(--qq-gold);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.new-badge {
    background: rgba(243, 156, 18, 0.18);
    border-radius: 30px;
    padding: 2px 8px;
    font-size: 9px;
    font-weight: 800;
    color: #e67e22;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.qq-desc {
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.3;
}
.highlight {
    color: var(--theme-color);
    font-weight: 500;
}
.qq-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.btn-qq {
    background: var(--btn-bg);
    border: none;
    border-radius: 50px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--theme-color);
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-qq-primary {
    background: var(--qq-blue);
    color: white;
}
.btn-qq-primary i {
    color: white;
}
.btn-qq:active {
    transform: scale(0.96);
}

/* ========== 主测试卡片 ========== */
.SBTI-main-card {
    background: var(--bg-card);
    border-radius: 32px;
    box-shadow: 0 20px 35px -15px var(--shadow-color);
    padding: 22px 24px 26px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: 0.3s ease;
}
.test-badge-label {
    font-size: 12px;
    font-weight: 600;
    background: var(--tag-bg);
    color: var(--tag-text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 50px;
    margin-bottom: 12px;
    font-family: 'Quicksand', sans-serif;
}
h1 {
    font-size: 26px;
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    background: linear-gradient(135deg, #4a2e46, #b35d7e);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 8px;
    line-height: 1.2;
}
.sub-desc {
    font-size: 14px;
    color: var(--text-light);
    border-left: 2px solid var(--line-color);
    padding-left: 12px;
    margin: 8px 0 12px;
    line-height: 1.3;
}
.people-count {
    background: var(--bg-card);
    border-radius: 60px;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 16px;
    margin: 8px 0 16px;
    border: 1px solid var(--border-color);
}
.count-number {
    font-size: 20px;
    font-weight: 800;
    color: var(--theme-color);
    font-family: 'Quicksand', monospace;
}
.count-update {
    animation: gentlePop 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}
@keyframes gentlePop {
    50% { transform: scale(1.05); }
}
.two-test-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}
.test-card-item {
    flex: 1;
    min-width: 220px;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 18px;
    transition: 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 18px -6px var(--shadow-color);
    position: relative;
    overflow: hidden;
}
.test-card-item::before {
    content: "✨";
    font-size: 50px;
    position: absolute;
    bottom: -10px;
    right: -10px;
    opacity: 0.1;
    pointer-events: none;
}
.test-card-item:hover {
    transform: translateY(-4px);
    border-color: var(--line-color);
    box-shadow: 0 16px 28px -10px var(--shadow-color);
    background: var(--link-hover-bg);
}
.card-title {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.version-tag {
    font-size: 10px;
    background: var(--tag-bg);
    padding: 3px 10px;
    border-radius: 40px;
    color: var(--tag-text);
}
.card-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 6px 0 16px;
    line-height: 1.4;
}
.btn-test {
    background: #f0dce6;
    border: none;
    padding: 10px 0;
    width: 100%;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: #a5456c;
    cursor: pointer;
    transition: 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-test.normal {
    background: #e2f0ea;
    color: #2f6b5c;
}
.btn-test:hover {
    transform: scale(0.97);
    box-shadow: 0 3px 8px rgba(173, 85, 115, 0.15);
}

/* ========== 测试列表区域 ========== */
.other-tests-section {
    background: var(--bg-card);
    border-radius: 32px;
    margin-top: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 18px -6px var(--shadow-color);
}
.section-header {
    padding: 16px 20px 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}
.section-header span {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--tag-bg);
    color: var(--tag-text);
}
.test-list {
    padding: 0 8px 12px;
}
.test-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin: 6px 0;
    border-radius: 20px;
    background: var(--bg-card);
    transition: 0.25s;
    cursor: pointer;
    border: 1px solid var(--border-color);
}
.test-item:hover {
    border-color: var(--line-color);
    transform: translateX(3px);
    box-shadow: 0 6px 12px -3px var(--shadow-color);
}
.test-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.test-icon-img {
    width: 44px;
    height: 44px;
    border-radius: 24px;
    object-fit: cover;
    background: var(--tag-bg);
    padding: 4px;
}
.test-icon-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 24px;
    background: var(--tag-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--theme-color);
}
.test-text .name {
    font-size: 15px;
    font-weight: 650;
    color: var(--text-color);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.test-text .desc {
    font-size: 12px;
    color: var(--text-light);
}
.btn-start {
    background: #fdeaf1;
    border: none;
    padding: 7px 18px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 600;
    color: #b1597c;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-start:hover {
    background: #f5cfdf;
    transform: scale(0.96);
}

/* ========== 引用区域 ========== */
.quote-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 12px 16px;
    margin: 16px 0;
    box-shadow: 0 8px 18px -6px var(--shadow-color);
    text-align: center;
}
.quote-title {
    font-size: 14px;
    color: var(--theme-color);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.quote-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-color);
    min-height: 36px;
}
.quote-btn {
    margin-top: 8px;
    padding: 4px 14px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--btn-bg);
    color: var(--theme-color);
    font-size: 11px;
    cursor: pointer;
}

/* ========== 时间工具 ========== */
.time-tool-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 18px;
    margin: 16px 0;
    box-shadow: 0 8px 18px -6px var(--shadow-color);
    text-align: center;
}
.time-show {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-color);
    margin: 10px 0;
}
.rest-tip {
    margin-top: 12px;
    padding: 10px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
}
.tip-morning { background: rgba(144, 238, 144, 0.15); color: #2c8c42; }
.tip-noon { background: rgba(255, 223, 128, 0.15); color: #b88600; }
.tip-night { background: rgba(173, 196, 222, 0.15); color: #365486; }
.tip-late { background: rgba(200, 160, 220, 0.15); color: #8048a0; }

/* ========== 停留时间 & 分享按钮 ========== */
.stay-time-box {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    margin: 10px 0;
}
.share-btn {
    display: block;
    margin: 10px auto;
    padding: 8px 20px;
    background: var(--btn-bg);
    color: var(--theme-color);
    border-radius: 30px;
    border: none;
    font-size: 13px;
    cursor: pointer;
}

/* ========== 底部备案 ========== */
footer-note {
    text-align: center;
    margin-top: 30px;
    font-size: 11px;
    color: var(--text-light);
    display: block;
}
.footer-beian {
    text-align: center;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-light);
}
.footer-beian a {
    color: var(--text-light);
    text-decoration: none;
}
.footer-beian .sep {
    margin: 0 6px;
    color: var(--theme-color);
}

/* ========== 底部导航栏（手机专用） ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 8px 12px 12px;
    z-index: 1100;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-light);
    cursor: pointer;
    flex: 1;
    text-align: center;
}
.nav-item i {
    font-size: 22px;
}
.nav-item.active {
    color: var(--theme-color);
    font-weight: 500;
}
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
    body {
        padding-bottom: 70px;
    }
}
@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }
}

/* ========== 页面切换 ========== */
.page-section {
    display: none;
}
.page-section.active-section {
    display: block;
}

/* ========== 弹窗样式 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-box, .kf-modal-box {
    background: var(--bg-card);
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
    overflow: hidden;
}
.kf-modal-box {
    max-width: 360px;
    padding: 24px;
    text-align: center;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 18px;
    color: var(--theme-color);
    display: flex;
    align-items: center;
    gap: 8px;
}
.close-modal {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.03);
    z-index: 10;
}
.close-modal:hover {
    color: var(--theme-color);
    transform: rotate(90deg);
}
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
#kfzm_qrcode img {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    display: block;
    border-radius: 8px;
}
#wxnum {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}
#wxnum .copy {
    background: var(--btn-bg);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
}

/* ========== 树洞样式 ========== */
.shuhe-float-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--theme-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 99;
    font-size: 22px;
}
@media (max-width: 768px) {
    .shuhe-float-btn {
        bottom: 90px;
    }
}
.shuhe-float-btn .red-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #ff4444;
    border-radius: 50%;
    border: 2px solid var(--theme-color);
    display: none;
}
.shuhe-float-btn .red-dot.show {
    display: block;
}
.shuhe-notice {
    background: linear-gradient(135deg, rgba(179, 78, 116, 0.08), rgba(244, 165, 188, 0.08));
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.shuhe-notice .notice-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--theme-color);
    margin-bottom: 10px;
}
.shuhe-notice .notice-list {
    list-style: none;
    margin: 0 0 12px 0;
}
.shuhe-notice .notice-list li {
    font-size: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.shuhe-notice .notice-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.shuhe-notice .notice-tag {
    background: var(--tag-bg);
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 11px;
    color: var(--tag-text);
}
.shuhe-input-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}
.shuhe-input-row input,
.shuhe-input-row textarea {
    padding: 12px 14px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-color);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.shuhe-input-row textarea {
    border-radius: 20px;
    resize: none;
}
.shuhe-submit {
    background: var(--theme-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}
.shuhe-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.shuhe-list {
    max-height: 400px;
    overflow-y: auto;
}
.shuhe-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}
.shuhe-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}
.shuhe-nickname {
    font-weight: 600;
    color: var(--theme-color);
}
.shuhe-time {
    color: var(--text-light);
    font-size: 11px;
}
.shuhe-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-color);
    word-break: break-word;
}
.empty-shuhe, .loading-shuhe {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
}

/* ========== 响应式 ========== */
@media (max-width: 780px) {
    body {
        padding: 16px 14px 70px;
    }
    .SBTI-main-card {
        padding: 18px;
    }
    h1 {
        font-size: 24px;
    }
    .test-card-item {
        padding: 16px;
    }
}