/* --- 全局和重置 --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden; /* 防止动画溢出导致滚动条 */
    font-family: 'Roboto', sans-serif; /* 默认字体 */
    color: #e0e0e0; /* 浅灰色文字 */
}

body {
    /* 炫酷的动态渐变背景 */
    background: linear-gradient(-45deg, #0a0a2a, #1a0a3a, #0a1a2a, #2a0a1a);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    display: flex; /* 用于垂直居中容器 */
    justify-content: center;
    align-items: center;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- 内容容器 --- */
.container {
    position: relative; /* 用于扫描线定位 */
    z-index: 2;
    text-align: center;
    padding: 20px;
    max-width: 90%;
    width: 800px; /* 最大宽度 */
}

.content {
    position: relative; /* 确保内容在扫描线之上 */
    z-index: 3;
    padding: 30px;
    background: rgba(0, 0, 0, 0.2); /* 轻微的半透明背景增加对比 */
    border-radius: 8px;
    backdrop-filter: blur(5px); /* 毛玻璃效果 (可选) */
    border: 1px solid rgba(0, 255, 255, 0.1); /* 细微的青色边框 */
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.1); /* 轻微辉光 */
}


/* --- 标题样式 --- */
h1 {
    font-family: 'Orbitron', sans-serif; /* 科技感字体 */
    font-size: 3rem; /* 调整字体大小 */
    color: #00ffff; /* 鲜艳的青色 */
    margin-bottom: 10px; /* 减小底部外边距，为时间腾出空间 */
    text-shadow: 0 0 8px #00ffff, 0 0 15px rgba(0, 255, 255, 0.7); /* 发光效果 */
    min-height: 4rem; /* 防止打字时跳动 */
    line-height: 1.2;
}

/* --- 打字机光标 --- */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 3rem; /* 匹配 H1 字体大小 */
    background-color: #00ffff;
    animation: blink 0.8s infinite;
    vertical-align: bottom;
    margin-left: 5px;
    box-shadow: 0 0 5px #00ffff; /* 光标也发光 */
}

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

/* --- 时间显示容器及样式 --- */
.date-time-container {
    margin-bottom: 25px; /* 与副标题的间距 */
    /* 注意：这里不再需要height和overflow:hidden，因为只对秒的span做动画 */
}

.date-time-display {
    font-family: 'Orbitron', sans-serif; /* 科技感字体 */
    font-size: 1.8rem; /* 时间字体大小，比标题小一些 */
    color: #00ccff; /* 稍柔和的青色 */
    text-shadow: 0 0 5px #00ccff, 0 0 10px rgba(0, 204, 255, 0.5); /* 发光效果 */
    white-space: nowrap; /* 防止时间换行 */
    display: inline-block; /* 允许内部元素排列 */
}

.date-part, .time-hm-part {
    /* 日期和时分部分不需要动画 */
    vertical-align: top; /* 与秒数对齐 */
}

/* 秒数容器，用于控制overflow:hidden */
.time-s-container {
    display: inline-block; /* 使其能与前面的时分排列 */
    width: 2.5rem; /* 给秒数留出固定宽度，防止跳动 */
    height: 1.8rem; /* 高度与 .time-display 字体大小相关，防止溢出 */
    overflow: hidden;
    vertical-align: top; /* 与前面的文本对齐 */
    line-height: 1.8rem; /* 保证文本垂直居中在这个容器内 */
}

.time-s-part {
    display: inline-block; /* 必须是block或inline-block才能应用transform */
    vertical-align: top; /* 与其容器的顶部对齐 */
    /* 添加过渡效果，用于秒数动画 */
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* 秒数更新时的隐藏状态 */
.time-s-part.hidden {
    opacity: 0;
    transform: translateY(10px); /* 可以根据需要调整方向和距离，这里是向下移动 */
}

/* --- 副标题样式 --- */
.subtitle {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #c0c0c0; /* 稍暗的灰色 */
    font-weight: 300;
    opacity: 0; /* 初始隐藏 */
    transform: translateY(20px); /* 初始向下偏移 */
    /* 调整 transition-delay，确保在时间显示后出现 */
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
    transition-delay: 1s; /* 等待主标题和初始时间显示 */
    max-width: 600px; /* 控制行宽 */
    margin: 0 auto; /* 居中 */
}

.subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- 扫描线效果 --- */
.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: linear-gradient(
        to bottom,
        rgba(20, 20, 50, 0) 0%,
        rgba(0, 255, 255, 0.08) 3%, /* 更细更微妙的线条 */
        rgba(20, 20, 50, 0) 6%
    );
    background-size: 100% 10px; /* 线条间距 */
    animation: scan 10s linear infinite;
    pointer-events: none; /* 允许鼠标穿透 */
}

@keyframes scan {
    0% { background-position: 0 0; }
    100% { background-position: 0 -100px; } /* 调整速度 */
}


/* --- 响应式设计 (示例) --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
        min-height: 3rem;
    }
    .typing-cursor {
        height: 2.2rem;
    }
     .date-time-display {
        font-size: 1.5rem;
    }
     .time-s-container {
        height: 3.5rem;
        line-height: 1.5rem;
        width: 2rem;
    }
    .subtitle {
        font-size: 1rem;
    }
    .content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
        min-height: 2.5rem;
    }
    .typing-cursor {
        height: 1.8rem;
    }
     .date-time-display {
        font-size: 1.2rem;
    }
     .time-s-container {
        height: 1.2rem;
        line-height: 1.2rem;
        width: 1.8rem;
    }
    .subtitle {
        font-size: 0.9rem;
    }
}