:root {
    --bg-color: #f5f5f5;
    --container-bg: white;
    --text-color: #333;
    --ms-color: #ff6b6b;
    --date-color: #666;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --icon-bg: #f0f0f0;
    --icon-hover: #e0e0e0;
    --icon-text: #555;
}

.dark-mode {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #f0f0f0;
    --ms-color: #ff8a8a;
    --date-color: #aaa;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --icon-bg: #2a2a2a;
    --icon-hover: #3a3a3a;
    --icon-text: #ccc;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
    font-family: 'Arial', sans-serif;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
    box-sizing: border-box;
}

.clock-container {
    text-align: center;
    padding: clamp(0.8rem, 2vw, 2.5rem);
    background-color: var(--container-bg);
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--shadow-color);
    animation: fadeIn 1.5s ease-in-out;
    display: inline-block;
    width: min(95vw, 1000px);
    box-sizing: border-box;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
    margin-bottom: clamp(1rem, 3vh, 2rem);
    overflow: hidden;
}

.fullscreen .clock-container {
    background-color: transparent;
    box-shadow: none;
    padding: 0;
}

.clock {
    font-size: min(7vw, 20vh);
    line-height: 0.9;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    white-space: nowrap;
    transition: font-size 0.1s linear;
    letter-spacing: -0.02em;
    
    /* 渐变色文字效果 */
    background: linear-gradient(45deg, #ff7eb9, #ff65a3, #7afcff, #feff9c);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-animation 6s ease infinite;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.milliseconds {
    font-size: min(3.5vw, 10vh);
    transition: font-size 0.1s linear;
    
    /* 毫秒使用不同的渐变色 */
    background: linear-gradient(45deg, #7afcff, #feff9c, #ff7eb9, #ff65a3);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-animation 6s ease infinite reverse;
}

.date {
    margin-top: clamp(0.5rem, 2vh, 1.5rem);
    font-size: min(2vw, 3vh);
    color: var(--date-color);
    transition: font-size 0.1s linear;
    white-space: normal;
    word-break: keep-all;
}

.app-icons {
    display: flex;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
    flex-wrap: wrap;
    width: clamp(280px, 90vw, 800px);
    padding: clamp(0.5rem, 1vw, 1rem);
    box-sizing: border-box;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.app-icon:hover {
    transform: translateY(-5px);
}

.icon {
    width: clamp(40px, 10vw, 60px);
    height: clamp(40px, 10vw, 60px);
    border-radius: 15px;
    background-color: var(--icon-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.2rem, 4vw, 2rem);
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: background-color 0.3s ease;
}

.app-icon:hover .icon {
    background-color: var(--icon-hover);
}

.icon-label {
    font-size: 0.9rem;
    color: var(--icon-text);
    transition: color 0.3s ease;
}

.controls {
    position: fixed;
    top: clamp(10px, 2vh, 20px);
    right: clamp(10px, 2vw, 20px);
    display: flex;
    gap: clamp(8px, 1vw, 15px);
    z-index: 100;
}

.control-btn {
    background: none;
    border: none;
    font-size: clamp(1.5rem, 3vw, 2rem);
    cursor: pointer;
    color: var(--text-color);
    transition: transform 0.3s ease, color 0.3s ease;
    padding: 5px;
}

.control-btn:hover {
    transform: scale(1.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .clock {
        font-size: 20vh;
    }
    
    .milliseconds {
        font-size: 10vh;
    }
    
    .date {
        font-size: 2vh;
    }
    
    .app-icons {
        gap: 1rem;
    }
    
    .icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .icon-label {
        font-size: 0.8rem;
    }
}

/* 照片墙相关样式保留在这里，但重命名为 photos.html */
.gallery-container {
    width: 100%;
    height: 100vh;
    padding: 20px 0;
    overflow: hidden;
}

.clothesline {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 0;
    padding: 0;
    transition: all 0.5s ease;
}

.line-group {
    position: relative;
    height: 250px;
    min-height: 250px;
    flex-shrink: 0;
    margin: 0;
    transform-origin: center left;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* 设置绳子的层级和视觉效果，从远到近 */
.line-group:nth-child(1) { 
    z-index: 10;
    transform: scale(0.9) translateY(0);
}
.line-group:nth-child(2) { 
    z-index: 20;
    transform: scale(0.95) translateY(20px);
}
.line-group:nth-child(3) { 
    z-index: 30;
    transform: scale(1) translateY(40px);
}

.line {
    position: absolute;
    top: 30%;
    left: 0;
    right: 0;
    height: 3px;
    background: #8b4513;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 为每根绳子设置不同的视觉效果，从远到近 */
.line-group:nth-child(1) .line {
    background: #a67953;  /* 最浅的颜色 */
    height: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.line-group:nth-child(2) .line {
    background: #9b6533;
    height: 2.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.line-group:nth-child(3) .line {
    background: #8b4513;  /* 最深的颜色 */
    height: 3px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* 调整照片大小以配合深度效果 */
.line-group:nth-child(1) .photo {
    height: 100px;
    border: 6px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.line-group:nth-child(2) .photo {
    height: 110px;
    border: 7px solid white;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.line-group:nth-child(3) .photo {
    height: 120px;
    border: 8px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

.photos {
    position: absolute;
    top: 30%;  /* 与水平绳子对齐 */
    left: 0;
    right: 0;
    height: 200px;
    padding: 20px;
    display: flex;
    gap: 30px;
    overflow-x: auto;
    overflow-y: visible;
}

/* 为每行照片添加交错效果 */
.line-group:nth-child(even) .photos {
    direction: rtl; /* 偶数行照片从右向左排列 */
}

.line-group:nth-child(even) .photo {
    direction: ltr; /* 保持照片本身方向正常 */
}

.photos::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.photo-container {
    position: relative;
    display: inline-block;
    margin-top: 0;  /* 移除顶部边距 */
    transform-origin: center top;
}

.photo-string {
    position: absolute;
    top: -25px;  /* 调整长度以确保接触到水平绳子 */
    left: 50%;
    width: 2px;
    height: 30px;  /* 增加长度 */
    background: #654321;
    transform: translateX(-50%);
}

/* 添加挂绳与水平绳子的连接装饰 */
.photo-string::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: #654321;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.photo {
    display: block;
    border-top: none !important;  /* 移除顶部边框 */
    margin-top: -5px;  /* 向上移动以衔接挂绳 */
    position: relative;  /* 添加定位 */
}

/* 添加挂绳和照片的连接处装饰 */
.photo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 8px;
    background: #654321;
    border-radius: 0 0 5px 5px;
}

/* 调整不同距离的挂绳样式 */
.line-group:nth-child(1) .photo-string {
    background: #987654;
    width: 1.5px;
    height: 28px;  /* 稍微短一点 */
}
.line-group:nth-child(1) .photo-string::before {
    width: 5px;
    height: 5px;
    background: #987654;
}

.line-group:nth-child(2) .photo-string {
    background: #876543;
    width: 1.8px;
    height: 29px;
}
.line-group:nth-child(2) .photo-string::before {
    width: 5.5px;
    height: 5.5px;
    background: #876543;
}

.line-group:nth-child(3) .photo-string {
    background: #654321;
    width: 2px;
    height: 30px;
}
.line-group:nth-child(3) .photo-string::before {
    width: 6px;
    height: 6px;
    background: #654321;
}

/* 移除固定角度的样式 */
.photo:nth-child(even) {
    /* 移除 transform */
}

.photo:hover {
    transform: scale(1.1) rotate(0) translateY(0) !important; /* 添加 !important 以覆盖内联样式 */
    z-index: 100;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.close {
    position: absolute;
    right: 35px;
    top: 15px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.page-title {
    font-size: clamp(1.5rem, 4vh, 3rem);
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: clamp(0.5rem, 2vh, 1rem);
    text-align: center;
    transition: color 0.3s ease;
    font-family: 'Arial', sans-serif;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.subtitle {
    font-size: clamp(1rem, 2.5vh, 1.8rem);
    color: var(--date-color);
    margin-bottom: clamp(0.5rem, 2vh, 1rem);
    text-align: center;
    transition: color 0.3s ease;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.fullscreen .page-title,
.fullscreen .subtitle {
    display: none;
}

@media (max-width: 768px) {
    .page-title {
        font-size: 3vh;
    }
    
    .subtitle {
        font-size: 2vh;
    }
}

/* 添加移动端优化样式 */
@media (max-width: 480px) {
    body {
        padding: 1rem 0;
    }
    
    .page-title {
        font-size: 2.5vh;
        margin-bottom: 0.5rem;
    }
    
    .subtitle {
        font-size: 1.8vh;
        margin-bottom: 0.5rem;
    }
    
    .clock-container {
        padding: 1rem;
        margin-bottom: 1rem;
        width: 95vw;
        min-width: 300px;
    }
    
    .clock {
        font-size: min(12vh, 12vw);
        letter-spacing: -0.05em;
    }
    
    .milliseconds {
        font-size: min(6vh, 6vw);
    }
    
    .date {
        margin-top: 0.8rem;
        font-size: min(1.8vh, 3vw);
        white-space: normal; /* 允许日期在必要时换行 */
        word-break: keep-all; /* 保持中文词组完整 */
    }
    
    .app-icons {
        gap: 0.8rem;
        padding: 0.5rem;
        max-width: 95vw;
    }
    
    .icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        margin-bottom: 0.3rem;
    }
    
    .icon-label {
        font-size: 0.7rem;
    }
    
    .controls {
        top: 10px;
        right: 10px;
        gap: 10px;
    }
    
    .control-btn {
        font-size: 1.5rem;
    }
}

/* 超小屏幕设备优化 */
@media (max-width: 360px) {
    .clock-container {
        padding: 0.7rem;
        min-width: 280px;
    }
    
    .clock {
        font-size: min(10vh, 11vw);
        letter-spacing: -0.08em;
    }
    
    .milliseconds {
        font-size: min(5vh, 5.5vw);
    }
}

/* 添加横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
        padding: 0.5rem;
    }
    
    .page-title {
        width: 100%;
        font-size: 2.5vh;
        margin-bottom: 0.3rem;
    }
    
    .clock-container {
        margin-bottom: 0;
        margin-right: 1rem;
        padding: 1rem 1.5rem;
    }
    
    .clock {
        font-size: 12vh;
    }
    
    .milliseconds {
        font-size: 6vh;
    }
    
    .date {
        margin-top: 0.5rem;
        font-size: 1.5vh;
    }
    
    .subtitle {
        display: none;
    }
    
    .app-icons {
        max-width: 40vw;
        gap: 0.8rem;
    }
    
    .icon {
        width: 40px;
        height: 40px;
    }
}

/* 添加触摸设备优化 */
@media (hover: none) {
    .app-icon:active {
        transform: translateY(-5px);
    }
    
    .app-icon:active .icon {
        background-color: var(--icon-hover);
    }
}

/* 移除全局过渡效果，它可能导致响应不够灵敏 */
* {
    transition: none; /* 移除全局过渡，让各元素使用自己的过渡设置 */
}

/* 为特定元素添加过渡效果 */
.clock-container {
    text-align: center;
    padding: clamp(0.8rem, 2vw, 2.5rem);
    background-color: var(--container-bg);
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--shadow-color);
    animation: fadeIn 1.5s ease-in-out;
    display: inline-block;
    width: min(95vw, 1000px); /* 简化为直接使用 min 函数 */
    box-sizing: border-box;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
    margin-bottom: clamp(1rem, 3vh, 2rem);
    overflow: hidden;
}

/* 添加窗口大小变化的监听器支持 */
@media (min-width: 0px) {
    /* 这个空的媒体查询可以触发浏览器重新计算响应式值 */
    /* 某些浏览器在窗口大小变化时可能不会重新计算 min() 和 clamp() 函数 */
}

/* 添加 JavaScript 支持提示 */
/* 
   注意：为了确保在所有浏览器中都能正确响应窗口大小变化，
   可以考虑添加以下 JavaScript 代码到页面中：

   window.addEventListener('resize', function() {
       // 触发重绘
       document.body.style.display = 'none';
       document.body.offsetHeight; // 强制重排
       document.body.style.display = '';
   });
*/

/* 深色模式下的时钟渐变色调整 */
.dark-mode .clock {
    background: linear-gradient(45deg, #ff9eb9, #ff85c3, #8afcff, #feff7c);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 深色模式下的毫秒渐变色调整 */
.dark-mode .milliseconds {
    background: linear-gradient(45deg, #8afcff, #feff7c, #ff9eb9, #ff85c3);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
}

/* 渐变色动画 */
@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
} 


/* 左上角LOGO和名称样式 */
.logo-container {
    position: fixed;
    top: 20px;
    left: 50px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.logo-name {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .logo-container {
        top: 15px;
        left: 15px;
    }
    .logo-name {
        font-size: 16px;
    }
}