/* 全局重置和基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: #0a0a1a;
    color: #f0f0f0;
    overflow-x: hidden;
}

/* 动态背景 */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

/* 滚动容器 */
.container {
    scroll-snap-type: y mandatory;
    overflow-y: scroll; /* 默认允许滚动，JS会先禁用它 */
    height: 100vh;
    /* --- 新增：隐藏滚动条 --- */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
/* --- 新增：隐藏滚动条 (Chrome, Safari) --- */
.container::-webkit-scrollbar {
    display: none;
}


/* 用于JS控制的滚动禁用样式 */
.no-scroll {
    overflow-y: hidden;
}


/* 页面通用样式 */
.page {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    scroll-snap-align: start;
    position: relative;
    padding: 20px;
}

.content {
    max-width: 800px;
    animation: fadeIn 2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 第一页：打字机 */
#typewriter {
    font-size: 2.5rem;
    font-weight: 300;
    min-height: 8rem; /* 保证高度防止抖动 */
    display: inline-block;
}

.scroll-down-prompt {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #aaa;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0; /* 默认隐藏 */
    transition: opacity 0.5s ease-in-out; /* 渐显动画 */
}

/* 用于JS控制的显示样式 */
.scroll-down-prompt.visible {
    opacity: 1;
}

.mouse {
    width: 25px;
    height: 40px;
    border: 2px solid #aaa;
    border-radius: 20px;
    position: relative;
    margin-top: 5px;
}
.mouse::before {
    content: '';
    width: 4px;
    height: 8px;
    background: #aaa;
    position: absolute;
    border-radius: 2px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll-indicator 2s infinite;
}
@keyframes scroll-indicator {
    0% { top: 8px; opacity: 1; }
    100% { top: 20px; opacity: 0; }
}


/* --- 第二页：时间线美化 --- */
#page2 h2 {
    margin-bottom: 50px;
    font-size: 2.2rem;
    font-weight: 300;
    color: #f0f0f0;
}

.timeline {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding-left: 20px;
    border-left: 2px solid #444;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
    padding-left: 30px;
    text-align: left;
    /* 默认隐藏，准备执行动画 */
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* 当父容器有 .visible 类时，为子元素应用动画延迟 */
#timeline.visible .timeline-item {
    opacity: 1;
    transform: translateX(0);
}

#timeline.visible .timeline-item:nth-child(1) { transition-delay: 0.2s; }
#timeline.visible .timeline-item:nth-child(2) { transition-delay: 0.4s; }
#timeline.visible .timeline-item:nth-child(3) { transition-delay: 0.6s; }
#timeline.visible .timeline-item:nth-child(4) { transition-delay: 0.8s; }


.timeline-dot {
    position: absolute;
    left: -11px; /* (dot_width/2 + border_width) */
    top: 5px;
    width: 20px;
    height: 20px;
    background: #ffd700;
    border-radius: 50%;
    border: 4px solid #0a0a1a;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.3);
    box-shadow: 0 0 15px #ffd700;
}

.timeline-content h3 {
    margin-bottom: 5px;
    color: #ffd700;
    font-weight: 400;
    transition: color 0.3s ease;
}
.timeline-item:hover .timeline-content h3 {
    color: #ffeb81;
}

.timeline-content p {
    font-size: 1rem;
    color: #ccc;
    font-weight: 300;
    line-height: 1.6;
}

/* --- 第三页：代码表白 --- */
.code-container {
    width: 90%;
    max-width: 800px;
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    animation: fadeIn 2s ease-in-out;
}

.code-header {
    background-color: #333;
    padding: 10px 15px;
    display: flex;
    align-items: center;
}

.code-header .buttons { display: flex; }
.code-header .dot { width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; }
.code-header .title { color: #bbb; font-family: 'Fira Code', monospace; margin: 0 auto; padding-right: 50px; }

.code-body {
    padding: 20px;
    text-align: left;
    height: 45vh;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* 代码语法高亮样式 */
pre { margin: 0; }
pre code {
    white-space: pre-wrap;
    color: #9CDCFE; /* 默认变量/参数颜色 */
}
/* 光标效果 */
#code-block::after {
    content: '█';
    animation: blink 1s step-end infinite;
    color: #f0f0f0;
}
@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}
#code-block.finished-typing::after {
    display: none;
}


.comment { color: #6A9955; font-style: italic; } /* 注释 */
.keyword { color: #C586C0; font-weight: bold; } /* const, new, function, if, else */
.string { color: #CE9178; } /* 字符串 */
.variable { color: #4FC1FF; } /* Me, You, OurStory */
.function-name { color: #DCDCAA; } /* Promise, resolve, reject, etc. */
.property { color: #9CDCFE; } /* name, status, etc. */

.final-call {
    background: #252526;
    padding: 20px;
    border-top: 1px solid #333;
    position: relative; /* 用于爱心动画定位 */
}

#final-message {
    color: #ccc;
    font-size: 1rem;
    margin-bottom: 20px;
}

/* 交互按钮样式 */
#choice-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.choice-btn {
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

#yes-button { background-color: #4CAF50; /* 绿色 */ }
#yes-button:hover { background-color: #66bb6a; }

#no-button { background-color: #f44336; /* 红色 */ }
#no-button:hover { background-color: #ef5350; }


#result-display {
    display: none; /* 修改：默认隐藏 */
    margin-top: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 1.1rem;
    min-height: 40px; /* 防止抖动 */
    line-height: 1.5;
    white-space: pre-wrap;
    text-align: center;
}

/* 爱心动画效果 */
#heart-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 让鼠标事件穿透 */
    overflow: hidden;
}
.heart {
    position: absolute;
    left: 50%;
    bottom: 20px;
    font-size: 24px;
    color: red;
    animation: float-up 4s ease-out infinite;
    opacity: 0;
}
.heart::before {
    content: '❤️';
}

@keyframes float-up {
    0% {
        transform: translateY(0) translateX(-50%);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) translateX(-50%);
        opacity: 0;
    }
}


/* --- 新增：高亮 'Us' 的样式 --- */
.highlight-us {
    color: #ff8c8c; /* 一种更浪漫的粉红色 */
    font-weight: bold; /* 加粗 */
    text-shadow: 0 0 8px #ff8c8c; /* 添加同色发光效果 */
    font-style: normal; /* 确保它不是斜体 */
}


/* 媒体查询，适配移动端 */
@media (max-width: 768px) {
    #typewriter {
        font-size: 1.8rem;
    }
    .code-body {
        font-size: 0.8rem;
        height: 40vh;
    }
    /* 减小移动端按钮尺寸 */
    .choice-btn {
        padding: 10px 18px; /* 减小内边距 */
        font-size: 0.9rem;   /* 减小字体大小 */
    }

    /* --- 新增：在移动端调整结果显示的字号 --- */
    #result-display {
        font-size: 0.85rem; /* 减小字体大小以适应屏幕 */
        padding: 0 10px;  /* 增加一些左右内边距防止贴边 */
    }
}

/* 新增页面隐藏样式 */
.page.hidden {
    display: none;
}

/* 来自 index (1).html 的样式 */
#heartCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}
.code-footer {
    position: absolute;
    bottom: 30px;
    color: #777;
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    z-index: 2;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}
.cursor {
    display: inline-block;
    width: 2px;
    height: 16px;
    background-color: orange;
    margin-left: 2px;
    animation: blink .75s step-end infinite;
}
@keyframes blink {
    from, to { background-color: transparent }
    50% { background-color: orange }
}
@media (max-width: 768px) {
    .code-footer { font-size: 14px; bottom: 20px; }
    .cursor { width: 8px; }
}