/* 定义数字字体 */
@font-face {
    font-family: digit;
    src: url('../fonts/digital-7_mono.ttf') format("truetype");
}

/* --- 基础布局和样式 --- */

/* PC端：让内容容器居中 */
#content {
    width: 1110px;
    margin: 50px auto;
}

#loveHeart {
    position: relative;
}

#words {
    position: absolute;
    text-align: center;
    left: 50%;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
}

#elapseClock, #loveu {
    text-align: center;
    margin-right: 0;
}


/* --- 文本和代码颜色 --- */
#code .keyword {
    color: deeppink;
}

#code .keyword.happy {
    color: orangered;
}

#code .comments {
    color: hotpink;
}

/*
 * ↓↓↓↓↓↓ 以下是本次修改的核心 ↓↓↓↓↓↓
 * 使用 CSS 伪元素和动画创建光标
*/
#code.typing::after {
    content: '_';
    animation: blink 1s infinite;
    -webkit-animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

@-webkit-keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}
/* ↑↑↑↑↑↑ 修改结束 ↑↑↑↑↑↑ */


/* --- 浏览器不支持时的错误提示样式 --- */
#errorMsg {
    width: 100%;
    text-align: center;
    font-size: 24px;
    position: absolute;
    top: 100px;
    left: 0;
    color: #FF0000;
}


/* --- 响应式设计：针对移动端设备 --- */
@media (max-width: 768px) {
    #content {
        width: 100%;
        margin-top: 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #code {
        width: 90%;
        height: auto;
        margin: 10px auto;
        font-size: 11px;
        float: none;
    }

    #loveHeart {
        width: 100%;
        height: 450px;
        margin: 20px auto;
        float: none;
    }

    #garden {
        width: 100%;
        height: 100%;
    }

    #words {
        font-size: 18px;
        width: 90%;
    }

    #messages {
        visibility: visible !important;
        opacity: 1 !important;
    }

    #loveu {
        font-size: 16px;
        margin-top: 20px;
    }
}