/* style.css - 包含移动端自适应优化的完整版本 */

/* =============================================================== */
/* --- 0. 全局通用修正（确保页面不横向溢出） --- */
/* =============================================================== */
* {
    box-sizing: border-box; /* 边框和内边距不增加元素的总宽度 */
    word-break: break-word; /* 允许长单词换行 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* 关键：隐藏横向滚动条，防止内容溢出 */
}

/* =============================================================== */
/* --- 1. 页眉 (Header) 样式 --- */
/* =============================================================== */

/* 页眉样式 */
.official-header {
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 50px; /* 桌面端内边距 */
}
.logo-group img {
    height: 40px;
}
.official-header nav a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
    margin-left: 30px;
    transition: color 0.3s;
}
.official-header nav a:hover {
    color: #1e3a8a;
    text-decoration: underline;
}

/* =============================================================== */
/* --- 2. 页面主体内容样式 --- */
/* =============================================================== */

/* 修正：为固定页眉留出空间 */
.main-content-wrapper {
    flex-grow: 1;
    padding-top: 85px; /* 预留头部高度（桌面端 15px*2 + 40px logo + 15px 左右） */
    padding-bottom: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

h1 {
    text-align: center;
    color: #1a73e8;
    margin-bottom: 30px;
    font-size: 1.8em;
}

/* 主题卡片布局 */
.theme-grid {
    display: grid;
    /* 核心响应式网格设置 */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.theme-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
}

.theme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* 预览图容器样式 */
.preview-image-container {
    width: 100%;
    position: relative; 
    background-color: #e9ecef;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 预览图图片样式 */
.preview-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* 确保图片完整显示 */
}

.theme-content {
    padding: 15px;
    flex-grow: 1;
}

.theme-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 10px;
    color: #007bff;
}

.prompt-label {
    display: block;
    font-size: 0.85em;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.prompt-text-wrapper {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #28a745;
}

.prompt-text {
    font-size: 0.9em;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

/* 复制按钮样式 */
.copy-prompt {
    display: block;
    width: 100%; 
    margin-top: 15px;
    padding: 10px;
    background-color: #343a40;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s;
}
.copy-prompt:hover {
    background-color: #23272b; 
}

/* 通用按钮样式 */
.utility-button, .load-more-button {
    padding: 12px 30px; 
    font-size: 16px; 
    cursor: pointer; 
    background-color: #343a40;
    color: white; 
    border: none; 
    border-radius: 5px;
    transition: background-color 0.2s;
    margin-top: 10px;
}
.utility-button:hover, .load-more-button:hover {
     background-color: #23272b;
}
.utility-button:disabled, .load-more-button:disabled {
     background-color: #adb5bd;
     cursor: not-allowed;
}

/* =============================================================== */
/* --- 3. 原图悬浮预览样式 --- */
/* =============================================================== */

/* 悬浮预览图容器 */
.base-image-preview {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40%;
    max-width: 150px;
    height: auto;
    border: 3px solid #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    transform: scale(0.9);
}

/* 悬停时显示 */
.theme-card:hover .base-image-preview {
    /* 桌面端特有效果，移动端由于缺乏 hover 事件，通常不触发 */
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* 内部图片样式 */
.base-image-preview img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    position: static !important; 
}

/* 原图提示标签样式 */
.base-image-label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 3px 6px;
    background-color: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-bottom-right-radius: 5px;
    z-index: 60;
    line-height: 1;
}

/* =============================================================== */
/* --- 4. 自动弹出窗口 (Modal) 样式 --- */
/* =============================================================== */

/* 模态框/弹窗本身 */
.modal {
    display: none;
    position: fixed; 
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* 允许垂直滚动 */
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(3px); 
}

/* 模态框内容 */
.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    width: 95%; 
    max-width: 1000px;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 关闭按钮 */
.close-button {
    /* 核心修改：将 'float: right' 移除，并设置为块级弹性容器 */
    /* color: #aaa;  -- 移除，颜色由内部内容控制 */
    display: flex; /* 使用 Flexbox 确保 X 居中 */
    justify-content: center;
    align-items: center;
    
    font-size: 32px; /* 维持 X 符号的大小 */
    line-height: 1;
    position: absolute;
    top: 15px;
    right: 20px;
    cursor: pointer;
    transition: all 0.2s ease-in-out; /* 添加过渡效果，使其更平滑 */
    
    /* 新增：高亮背景和尺寸 */
    width: 40px; /* 增加点击区域尺寸 */
    height: 40px;
    background-color: #f1f1f1; /* 浅灰色背景 */
    color: #333; /* 按钮文字颜色 */
    border-radius: 50%; /* 圆形按钮 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.close-button:hover,
.close-button:focus {
    /* 鼠标悬停/聚焦时的样式变化 */
    color: white; /* 符号变白 */
    background-color: #dc3545; /* 醒目的红色背景 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 弹窗内容排版 */
.modal-body h2 {
    color: #dc3545;
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 2em;
}

.modal-body .description {
    text-align: center;
    color: #343a40;
    font-size: 1.2em;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

/* 两栏布局容器 (桌面端) */
.steps-container {
    display: flex;
    flex-wrap: wrap; 
    gap: 30px;
    align-items: flex-start;
}

/* GIF 动图区域 (桌面端) */
.gif-display {
    flex: 3;
    min-width: 450px; 
    text-align: center;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    background-color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.guide-gif {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
}

.gif-caption {
    font-size: 0.9em;
    color: #999;
    margin-top: 8px;
}

/* 文本信息区域 (桌面端) */
.step-info {
    flex: 2;
    min-width: 250px;
    padding: 10px;
}

.step-info h3 {
    color: #000000;
    font-size: 1.1em;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* 兑换码高亮 */
.highlight-code {
    background-color: #ffe4e6;
    color: #c82333;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.2em;
    font-family: monospace;
    display: inline-block;
    margin: 5px 0;
}

/* 截止日期高亮 */
.highlight-date {
    font-weight: bold;
    color: #28a745;
}


.login-link {
    display: block;
    text-align: center;
    padding: 12px;
    margin-top: 15px;
    background-color: #23272b;
 
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.0em;
    transition: background-color 0.2s;
}

.login-link:hover {
    background-color: #000000;
}

.footer-note {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: center;
    font-size: 0.9em;
    color: #6c757d;
}


/* =============================================================== */
/* --- 5. 页脚 (Footer) 样式 --- */
/* =============================================================== */

.footer {
    width: 100%;
    background-color: #f1f3f4;
    color: #5f6368;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9em;
    margin-top: 20px; 
}
.footer a {
    color: #5f6368;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s;
}
.footer a:hover {
    color: #1a73e8;
    text-decoration: underline;
}



/* style.css 新增：页眉内按钮样式，使其醒目 */
.utility-button-in-nav {
    /* 继承 a 标签的基础样式，并覆盖 */
    padding: 6px 12px;
    background-color: #dc3545; /* 使用醒目的红色 */
    color: white !important; /* 确保文字是白色 */
    border-radius: 4px;
    font-weight: bold !important;
    text-decoration: none !important;
    margin-right: 20px; /* 增加与后续链接的间距 */
    transition: background-color 0.2s;
    line-height: 1.5; /* 确保垂直居中 */
}

.utility-button-in-nav:hover {
    background-color: #c82333;
}




/* =============================================================== */
/* --- 6. 移动端响应式调整 (@media 块) --- */
/* =============================================================== */

@media (max-width: 768px) {
    
    /* -------------------- 页面主体和网格调整 -------------------- */
    
    /* 缩小内容容器的水平边距和阴影 */
    .container {
        padding: 10px; 
        box-shadow: none; 
        border-radius: 0;
    }

    /* 主标题字体调整 */
    h1 {
        font-size: 1.2em;
        margin-bottom: 20px;
    }


    /* 网格列数在手机上改为 1 列 */
    .theme-grid {
        grid-template-columns: 1fr; 
        gap: 15px; 
    }

    /* -------------------- 页眉 (Header) 调整 -------------------- */
    .official-header {
        flex-direction: column; /* Logo 和 Nav 垂直堆叠 */
        align-items: center; 
        padding: 10px 5px; /* 减小边距 */
    }

    .logo-group {
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }

    .logo-group img {
        height: 30px; /* 缩小 Logo 尺寸 */
    }

    .official-header nav {
        display: flex;
        flex-wrap: wrap; 
        justify-content: center;
        width: 100%;
        padding: 5px 0;
        border-top: 1px dashed #eee; /* 分离 Logo 和 Nav */
    }

    .official-header nav a {
        margin: 3px 5px; 
        font-size: 0.8em; 
        padding: 3px 5px;
        white-space: nowrap; /* 确保链接不被断开 */
    }
    
    /* 调整主体内容区域的顶部内边距，以适配堆叠后的页眉高度 */
    .main-content-wrapper {
        padding-top: 120px; 
        padding-bottom: 10px;
    }

    /* -------------------- 弹窗 (Modal) 调整 -------------------- */
    
    /* 模态内容容器 */
    .modal-content {
        margin: 5px auto; 
         margin-top: 75px;
        padding: 20px; 
        width: 95%; 
        max-width: 85vw; 
        max-height: 85vh; 
        overflow-y: auto; /* 允许内容垂直滚动 */
    }
    
    /* 标题和描述调整 */
    .modal-body h2 {
        font-size: 1.4em;
        margin-top: 40px;
    }
    .modal-body .description {
        font-size: 1em;
        margin-bottom: 15px;
    }

    /* 核心排版调整：单列流式布局 */
    .steps-container {
        flex-direction: column;
        gap: 15px; 
    }

    .gif-display, .step-info {
        flex: none; /* 移除桌面端 flex 比例 */
        min-width: unset; /* 移除桌面端最小宽度限制 */
        width: 100%;
        padding: 0; 
    }
    
    /* GIF 动图显示优化 */
    .gif-display {
        border: none;
        background-color: transparent;
        padding-bottom: 10px;
        overflow: hidden;
    }
    
    .guide-gif {
        display: block; 
        max-width: 100%; 
        width: 100%; /* 确保图片宽度填充父容器 */
        height: auto;
        object-fit: contain;
        border: 1px solid #ddd;
        border-radius: 6px;
        margin: 0 auto;
    }
    
    /* 兑换码高亮文字调整 */
    .highlight-code {
        font-size: 1.1em;
        padding: 3px 6px;
    }
    
    .login-link {
        font-size: 1em;
        padding: 10px;
    }
    .utility-button-in-nav {
        margin-right: 5px; /* 减小间距 */
        padding: 4px 8px; /* 减小尺寸 */
    }
    .close-button {
        font-size: 24px; /* 进一步缩小 X 符号 */
        width: 35px;    /* 缩小点击区域 */
        height: 35px;
        top: 8px;       /* 靠近顶部 */
        right: 10px;    /* 靠近右侧 */
    }
}