/* 基础样式 */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #e74c3c;
    transition: background-color 0.5s ease;
}

/* 日期显示样式 */
.date-display {
    position: fixed;
    top: 14%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex !important;
    align-items: center;
    gap: 20px;
    visibility: visible !important;
    opacity: 1 !important;
}

#dateText {
    font-size: 2.5vw;
    color: rgba(255, 255, 255, 1);
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
    font-weight: 400;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

#weekText {
    font-size: 2vw;
    color: rgba(255, 255, 255, 1);
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 3px;
    font-weight: 400;
    padding-left: 20px;
    border-left: 2px solid rgba(255, 255, 255, 0.6);
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: color 0.5s ease, text-shadow 0.5s ease, border-color 0.5s ease;
}

/* 动画画布 — 必须在主样式表中同步加载，防止插件注入前参与 body flex 布局 */
#animationCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#animationCanvas.active {
    opacity: 1;
}

/* 时钟样式 */
.tick {
    padding-top: 0.2em;
    padding-bottom: 0.3em;
    font-size: 15vw;
    font-family: 'Helvetica Neue', sans-serif;    
    z-index: 10;
    position: relative;
    white-space: nowrap;
}

.tick-label {
    font-size: 0.375em;
    text-align: center;
}

.tick-group {
    margin: 0 0.25em;
    text-align: center;
}


/* 励志语样式 */
.quote-container {
    position: fixed;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    text-align: center;
    max-width: 92%;
    max-height: 30vh;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.quote-container::-webkit-scrollbar {
    display: none;
}

#quoteDisplay {
    padding: 25px 35px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity 1s ease-in-out;
    /* 防止闪烁的关键：在动画期间禁用 backdrop-filter 的重新计算 */
    will-change: opacity;
    contain: layout style paint;
}

#quoteEnglish {
    font-size: 2vw;
    color: rgba(255, 255, 255, 0.95);
    font-family: 'Georgia', 'Times New Roman', serif;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
    line-height: 1.5;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-style: italic;
    font-weight: 400;
}

#quoteChinese {
    font-size: 1.6vw;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    line-height: 1.6;
    letter-spacing: 1px;
    font-weight: 300;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .date-display {
        top: 6%;
        gap: 8px;
        max-width: calc(100% - 130px);
        left: 40%;
        transform: translateX(-50%);
    }
    
    #dateText {
        font-size: 3.2vw;
        letter-spacing: 1px;
    }
    
    #weekText {
        font-size: 2.6vw;
        padding-left: 12px;
        letter-spacing: 2px;
    }
    
    #quoteEnglish {
        font-size: 3.5vw;
        margin-bottom: 12px;
    }
    #quoteChinese {
        font-size: 2.8vw;
    }
    #quoteDisplay {
        padding: 20px 25px;
    }
}

@media (max-width: 480px) {
    /* 时钟上移到约 1/3 处，避免与励志语重叠 */
    body {
        align-items: flex-start;
        padding-top: 26vh;
    }

    .date-display {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
        top: 70px;
        left: 15px;
        transform: none;
        max-width: calc(100% - 30px);
    }

    /* 日期行内层 wrapper：竖排，防止年月日/星期/天气挤在同一行 */
    .date-display > div:first-child {
        flex-direction: column !important;
        gap: 4px !important;
        align-items: flex-start !important;
    }
    
    #dateText {
        font-size: 5vw;
    }
    
    #weekText {
        font-size: 4vw;
        padding-left: 0;
        border-left: none;
        padding-top: 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.3);
    }

    .weather-display {
        padding-top: 2px;
    }
    .weather-temp {
        font-size: 4vw !important;
    }
    .weather-desc {
        font-size: 3.5vw !important;
    }
    
    #quoteEnglish {
        font-size: 4.5vw;
        margin-bottom: 10px;
    }
    #quoteChinese {
        font-size: 3.5vw;
    }
    #quoteDisplay {
        padding: 15px 20px;
    }
}

/* 手机横屏模式 - 专门优化布局 */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
    /* 日期显示 - 缩小并移到左上角 */
    .date-display {
        top: 8px;
        left: 12px;
        transform: none;
        gap: 6px;
        white-space: nowrap;
        flex-wrap: nowrap;
        max-width: calc(100% - 180px);
    }
    
    #dateText {
        font-size: 2vw;
        letter-spacing: 1px;
        white-space: nowrap;
    }
    
    #weekText {
        font-size: 1.6vw;
        padding-left: 8px;
        letter-spacing: 1px;
        white-space: nowrap;
    }
    
    /* 时钟 */
    .tick {
        padding-bottom: 0.3em;
    }
    
    /* 励志语 - 更宽更靠上 */
    .quote-container {
        bottom: 12%;
        max-width: 90%;
        max-height: 22vh;
    }
    
    #quoteDisplay {
        padding: 10px 18px;
    }
    
    #quoteEnglish {
        font-size: 1.6vw;
        margin-bottom: 6px;
        line-height: 1.3;
    }
    
    #quoteChinese {
        font-size: 1.2vw;
        line-height: 1.4;
    }
}

/* 更小的横屏设备 - 进一步优化 */
@media (max-width: 700px) and (max-height: 400px) and (orientation: landscape) {
    .date-display {
        top: 5px;
        left: 10px;
        gap: 4px;
        white-space: nowrap;
        flex-wrap: nowrap;
    }
    
    #dateText {
        font-size: 1.6vw;
        white-space: nowrap;
    }
    
    #weekText {
        font-size: 1.2vw;
        padding-left: 6px;
        white-space: nowrap;
    }
    
    .quote-container {
        bottom: 10%;
        max-width: 90%;
        max-height: 18vh;
    }
    
    #quoteDisplay {
        padding: 8px 14px;
    }
    
    #quoteEnglish {
        font-size: 1.3vw;
        margin-bottom: 4px;
    }
    
    #quoteChinese {
        font-size: 1vw;
    }
}

/* 平板横屏优化 - 日期/天气移至左上角，时钟上移，谚语更宽 */
@media (min-width: 601px) and (orientation: landscape) and (max-height: 1200px) {
    /* 日期/天气/星期 - 左上角横向排列 */
    .date-display {
        top: 12px;
        left: 16px;
        transform: none;
        gap: 12px;
        white-space: nowrap;
        flex-wrap: nowrap;
        max-width: calc(100% - 220px);
    }
    
    #dateText {
        font-size: 1.6vw;
        letter-spacing: 1px;
        white-space: nowrap;
    }
    
    #weekText {
        font-size: 1.2vw;
        padding-left: 12px;
        letter-spacing: 1px;
        white-space: nowrap;
    }
    
    /* 时钟卡片上移 */
    .tick {
        padding-top: 0;
        padding-bottom: 1em;
    }
    
    /* 谚语区域 - 更宽，更多底部空间 */
    .quote-container {
        bottom: 18%;
        max-width: 92%;
        max-height: 28vh;
    }
    
    #quoteEnglish {
        font-size: 1.6vw;
        margin-bottom: 8px;
    }
    
    #quoteChinese {
        font-size: 1.4vw;
    }
}

/* 通知动画 */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification {
    animation: slideInRight 0.3s ease;
}
