﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #39c5bb;
    font-family: "Microsoft YaHei", sans-serif;
    display: flex;
    justify-content: center;
    padding: 40px 20px; /* 减小一点顶部内边距，给移动端更多空间 */
    /* 核心修改： */
    min-height: 100vh; /* 回退方案 */
    min-height: 100dvh;
    margin: 0;
}

.page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* 核心修改： */
    height: 100vh;
    height: 100lvh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

/* --- 1. 定义与首页一致的弹出动画 --- */
@keyframes detailsPopIn {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* --- 1. 定义退场动画：从 scale(1) 回到 scale(0.85) --- */
@keyframes detailsPopOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    100% {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
    }
}

/* --- 2. 定义退场类：强制执行退场动画 --- */
.details-wrapper.closing {
    /* 使用 !important 确保覆盖掉之前的 detailsPopIn 动画 */
    animation: detailsPopOut 0.15s cubic-bezier(0.4, 0, 1, 1) forwards !important;
    pointer-events: none; /* 防止退场时被再次点击 */
}

/* --- 3. 调整主容器层级 --- */
.details-wrapper {
    position: relative;
    z-index: 10; /* 确保内容在遮罩层之上 */
    width: 100%;
    max-width: 600px;
    background: #235d5a;
    padding: 4px;
    /* 之前的弹出动画保留 */
    opacity: 0;
    animation: detailsPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.3);
    z-index: 1200;
}

.details-inner {
    background: #f4f4f4;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- 返回按钮 (放在右上角) --- */
.back-nav {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(0, 0);
    width: 50px;
    height: 50px;
    background: #235d5a;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 30px;
    z-index: 10;
}

    .back-nav:hover {
        background: #000;
    }

/* --- 内容区块 --- */
.content-body {
    padding: 40px;
}

.image-container {
    width: 100%;
    border: 2px solid #235d5a;
    margin-bottom: 25px;
    background: #000;
}

.main-cover {
    width: 100%;
    display: block;
    object-fit: cover;
}

.title-block {
    font-size: 32px;
    font-weight: bold;
    color: #235d5a;
    margin-bottom: 20px;
    border-left: 12px solid #235d5a;
    padding-left: 20px;
    line-height: 1.2;
}

/* Markdown 内容样式整理 */
.markdown-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 10px;
    padding: 0 10px;
}

    .markdown-content hr {
        border: none;
        border-top: 2px dashed #ccc; /* 与下方按钮区虚线完全一致 */
        height: 0;
        /* 核心：将上边距设小一点，下边距设大一点，以平衡 p 标签的 margin-bottom */
        margin: 20px 0;
        clear: both;
    }

    .markdown-content p {
        margin-bottom: 1.5em;
    }

    .markdown-content code {
        background: #e0e0e0;
        padding: 2px 6px;
        font-family: Consolas, monospace;
        border: 1px solid #ccc;
    }

    .markdown-content img {
        max-width: 100%;
        border: 1px solid #ddd;
    }

/* --- 按钮区：直角长方块 --- */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 30px;
    border-top: 2px dashed #ccc;
    padding-top: 30px;
}

.action-btn {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #235d5a;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

    .action-btn:hover {
        background: #235d5a;
        color: white;
        transform: translateY(2px);
    }

    .action-btn .icon {
        width: 24px;
        height: 24px;
        margin-right: 12px;
        filter: grayscale(1);
    }

    .action-btn:hover .icon {
        filter: grayscale(0) brightness(2);
    }

.btn-text {
    font-weight: bold;
    flex: 1;
}

.counter-badge {
    font-size: 10px;
    background: #eee;
    color: #666;
    padding: 2px 5px;
    margin-left: 5px;
}



@media (max-width: 600px) {
    .content-body {
        padding: 20px;
    }

    .title-block {
        font-size: 24px;
    }

    .button-grid {
        grid-template-columns: 1fr;
    }
}
