/* style.css */

body {
    margin: 0;
    font-family: sans-serif;
    /* background-color: #f8f8f8; /* 移除或注释掉纯色背景 */
    color: #333;
    overflow: hidden; /* Prevent scrolling */
    background-size: cover; /* 覆盖整个背景区域 */
    background-position: center; /* 图片居中 */
    background-repeat: no-repeat; /* 不重复 */
}

.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden; /* Ensure main container also prevents scrolling */
}

.landing-page {
    padding: 20px;
    box-sizing: border-box;
}

.title {
    font-size: 3em;
    color: #FA4A4A;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
}

.music-toggle {
    position: absolute;
    top: 30px; /* 调整顶部位置 */
    right: 20px; /* 调整右侧位置 */
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    z-index: 10; /* 确保在其他内容之上 */
}

.music-toggle:hover {
    opacity: 1;
}

.music-toggle img {
    width: 30px;
    height: 30px;
    vertical-align: middle;
}

.heart-puzzle-container {
    margin-top: 30px;
    display: flex; /* 使用 Flexbox 布局 */
    flex-direction: row; /* 水平排列列 */
    justify-content: center; /* 居中对齐列 */
    gap: 5px; /* 列之间的间距 */
    width: 490px; /* 根据 9 列计算的总宽度 */
    margin: 30px auto 0 auto; /* 居中容器并添加顶部外边距 */
    padding: 0; /* 移除水平内边距 */
    box-sizing: border-box;
}

.heart-column {
    display: flex; /* 使用 Flexbox 布局 */
    flex-direction: column; /* 垂直排列拼图块 */
    gap: 5px; /* 拼图块之间的间距 */
}

.heart-column:nth-child(1),
.heart-column:nth-child(4),
.heart-column:nth-child(6),
.heart-column:nth-child(9) { /* 第一列, 第四列, 第六列和第九列 */
    margin-top: 16.67px; /* 向下偏移拼图块高度的 1/3 */
}

.heart-column:nth-child(5) { /* 第五列 */
    margin-top: 80px; /* 向上微调，减少大约 1/4 张图的高度 */
}

.puzzle-item {
    width: 50px; /* 固定拼图块大小 */
    height: 50px; /* 固定拼图块大小 */
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #eee;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.puzzle-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 确保图片覆盖整个区域 */
}

.puzzle-item:hover {
    transform: scale(1.05);
}

.content-pages {
    display: none; /* 初始隐藏内容页面 */
    width: 100%;
    height: 100%;
    overflow: auto; /* 允许内容滚动 */
}

.content-page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    background-color: #fff; /* 示例背景色 */
}

.content-page img {
    max-width: 90%;
    max-height: 70vh; /* 限制图片最大高度 */
    margin-bottom: 20px;
}

.content-page p, .content-page h3 {
    font-size: 1.2em;
    line-height: 1.6em;
    margin: 10px 0;
}


/* 情意绵绵按钮样式 */
.love-button {
    display: block; /* 让按钮独占一行 */
    margin: 20px auto; /* 居中并添加上下外边距 */
    padding: 10px 20px;
    font-size: 1.1em;
    color: #fff;
    background-color: #FA4A4A; /* 使用主题红色 */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.love-button:hover {
    background-color: #e03e3e; /* 悬停效果 */
}

/* API Key 设置按钮样式 */
.settings-button {
    position: absolute;
    right: 20px; /* 与音乐开关右侧对齐 */
    padding: 5px 10px;
    font-size: 0.9em;
    color: #fff;
    background-color: #666; /* 使用中性颜色 */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 10; /* 确保在其他内容之上 */
}

.settings-button:hover {
    background-color: #555;
}

#settings-button {
    top: 70px; /* 音乐开关下方40px */
}

#change-background-button {
    top: 110px; /* 设置按钮下方40px */
}

#change-music-button {
    top: 150px; /* 切换背景按钮下方40px */
}


/* 模态框样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed; /* 固定位置 */
    z-index: 1; /* 位于顶部 */
    left: 0;
    top: 0;
    width: 100%; /* 全屏 */
    height: 100%; /* 全屏 */
    overflow: auto; /* 如果内容过多允许滚动 */
    background-color: rgba(0,0,0,0.4); /* 半透明黑色背景 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
}

.modal-content {
    background-color: #ffe0e6; /* 粉红色底色 */
    margin: auto; /* 自动外边距实现居中 */
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* 内容区域宽度 */
    max-width: 500px; /* 最大宽度 */
    border-radius: 10px;
    position: relative; /* 相对定位，用于关闭按钮 */
    text-align: left; /* 文本左对齐 */
    word-wrap: break-word; /* 自动换行 */
    white-space: pre-wrap; /* 保留换行符 */
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* 隐藏图片缩放模态框的关闭按钮 */
#image-zoom-modal .image-zoom-close {
    display: none;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}


/* API Key 模态框内容样式 */
#api-key-modal .modal-content {
    text-align: center; /* 内容居中 */
}

#api-key-modal .modal-content h3 {
    margin-top: 0;
    color: #333;
}

#api-key-modal .modal-content input[type="text"] {
    width: calc(100% - 22px); /* 宽度适应容器，减去 padding 和 border */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

#api-key-modal .modal-content button {
    padding: 10px 20px;
    font-size: 1em;
    color: #fff;
    background-color: #FA4A4A;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#api-key-modal .modal-content button:hover {
    background-color: #e03e3e;
}

#api-key-modal .modal-content #api-key-status {
    margin-top: 15px;
    font-size: 0.9em;
    color: #666;
}

/* API Key 模态框关闭按钮样式 */
#api-key-modal .api-key-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    color: #aaa;
    cursor: pointer;
}

#api-key-modal .api-key-close:hover {
    color: #000;
}


/* 手机端适配 */
@media (max-width: 768px) {
    .title {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .heart-puzzle-container {
        flex-direction: row; /* 手机上水平排列列 */
        gap: 3px; /* 手机上列之间的间距更小 */
        width: 294px; /* 手机端 9 列计算的总宽度 */
    }

    .heart-column {
        gap: 3px; /* 手机上拼图块之间的间距更小 */
    }

    .heart-column:nth-child(1),
    .heart-column:nth-child(4),
    .heart-column:nth-child(6),
    .heart-column:nth-child(9) { /* 手机端第一列, 第四列, 第六列和第九列 */
        margin-top: 10px; /* 向下偏移拼图块高度的 1/3 */
    }

    .heart-column:nth-child(5) { /* 手机端第五列 */
        margin-top: 48px; /* 向上微调，减少大约 1/4 张图的高度 */
    }

    .puzzle-item {
        width: 30px; /* 手机上拼图块更小 */
        height: 30px; /* 手机上拼图块更小 */
    }

    .content-page img {
        max-width: 100%;
        max-height: 60vh;
    }

    .content-page p, .content-page h3 {
        font-size: 1em;
        line-height: 1.5em;
    }

    /* Styles for the new Count Days Modal */
    #count-days-modal .modal-content {
        max-width: 90%; /* Adjust max-width for mobile */
        padding: 10px; /* Adjust padding for mobile */
    }
}

/* 按钮容器样式 */
.button-container {
    display: flex; /* 使用 Flexbox 布局 */
    justify-content: center; /* 水平居中 */
    gap: 20px; /* 按钮之间的间距 */
    margin-bottom: 20px; /* 容器下方留白 */
}

/* 调整情意绵绵按钮的 margin，使其由容器控制 */
.love-button {
    display: inline-block; /* 允许在同一行 */
    margin: 0; /* 移除原有的 margin */
    padding: 10px 20px;
    font-size: 1.1em;
    color: #fff;
    background-color: #FA4A4A; /* 使用主题红色 */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.love-button:hover {
    background-color: #e03e3e; /* 悬停效果 */
}
/* Navigation buttons container style */
.navigation-buttons {
    display: flex; /* Use Flexbox for layout */
    justify-content: space-between; /* Distribute space between buttons */
    gap: 20px; /* Space between buttons */
    margin-top: 20px; /* Add space above the buttons */
    width: 100%; /* Ensure the container takes full width */
    max-width: 600px; /* Limit max width for better layout */
}

/* Navigation button style */
.navigation-buttons button {
    padding: 10px 20px;
    font-size: 1em;
    color: #fff;
    background-color: #FA4A4A; /* Use theme red */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.navigation-buttons button:hover {
    background-color: #e03e3e; /* Hover effect */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .navigation-buttons {
        flex-direction: column; /* Stack buttons vertically on small screens */
        gap: 10px; /* Adjust gap for vertical stacking */
        justify-content: space-around; /* Adjust spacing for small screens */
    }
}

#music-off {
    display: none;
}


/* Styles for the new Count Days Modal */
#count-days-modal .modal-content {
    text-align: center;
    padding: 5px 20px; /* 进一步调整上下内边距以收窄整体空间 */
    max-width: 400px; /* Adjust max-width to fit content better */
}

#love-clock-display-modal {
    font-size: 1.8em; /* Match the loading page clock size */
    color: #FA4A4A;
    text-align: center;
    margin-top: 0; /* 移除顶部外边距，由父元素padding控制 */
}

#love-clock-display-modal #love-text-line1-modal {
    display: block;
    font-size: 1.2em; /* 减小字体大小 */
    margin-bottom: -15px; /* 进一步使用负外边距收窄间距 */
    line-height: 1.2em; /* 恢复一个更合理的行高，因为字体大小已减小 */
}

#love-clock-display-modal #love-text-line2-modal {
    display: block;
    font-size: 1em;
    margin-top: -8px; /* 调整第二行文本与第一行的间距 */
    line-height: 1.2em;
}

#love-clock-display-modal .digit {
    font-size: 1.2em; /* 这里的数值控制字体大小 */
    font-weight: bold;
    margin: 0 5px;
}

@media (max-width: 768px) {
    #love-clock-display-modal #love-text-line1-modal {
        font-size: 1em; /* 手机端调整字体大小 */
        margin-bottom: -10px; /* 手机端调整间距 */
        line-height: 1.2em;
    }

    #love-clock-display-modal #love-text-line2-modal {
        font-size: 0.8em; /* 手机端调整字体大小 */
        margin-top: -5px; /* 手机端调整间距 */
        line-height: 1.2em;
    }

    #love-clock-display-modal .digit {
        font-size: 1em; /* 手机端调整字体大小 */
        margin: 0 2px; /* 手机端调整间距 */
    }
}

/* 图片缩放模态框的特定样式 */
#image-zoom-modal {
    transition: opacity 0.3s ease; /* 添加动画效果 */
}

#image-zoom-modal .modal-content.image-zoom-content {
    background-color: rgba(0, 0, 0, 0.8); /* 更深的背景色 */
    padding: 0; /* 移除内边距 */
    border: none; /* 移除边框 */
    width: 100%; /* 宽度全屏 */
    height: 100%; /* 高度全屏 */
    max-width: none; /* 移除最大宽度限制 */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* 隐藏超出部分 */
    pointer-events: none; /* 允许点击穿透到背景 */
}

#image-zoom-modal .modal-content.image-zoom-content > * {
    pointer-events: auto; /* 子元素恢复点击事件 */
}

#image-zoom-modal #zoomed-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* 确保图片完整显示在模态框内 */
    cursor: grab; /* 提示图片可拖动 */
    transition: transform 0.05s ease-out; /* 缩放过渡效果 */
}
