body {
    font-family: "cardo", sans-serif;
    scroll-behavior: smooth;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
}

header {
    color: #fff;
    text-align: center;
    padding: 30px 5px;
    background-color: #ffa0a8;
    top:0;
    position: sticky;
    z-index: 1000
}

header h1 {
    font-size: 2.5em;
    margin: 0 0 20px;
    font-weight: bold;
    color: #ffffff;
}
nav{
    margin-left: -2rem;
}
nav a{
    margin: 1rem;
    text-decoration: none;
    font-size: 1rem;
    color: #ffffff;
}
nav a:hover, nav a:focus {
  
    color: #ffdef1; 
}
.image {
    position: relative;
    display: flex; /* 使用 flex 布局 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    max-width: 55%; /* 最大宽度为父容器的 55% */
    height: auto; /* 高度自适应 */
    margin: 0 auto; /* 水平居中 */
}

.image img {
    max-width: 100%; /* 图片最大宽度为父容器宽度 */
    max-height: 100%; /* 图片最大高度为父容器高度 */
}
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    .image {
        position: relative;
    display: flex; /* 使用flex布局 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    max-width: 55%; /* 宽度100% */
    height: auto; /* 高度100%视口高度 */
    }
}

.image:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色背景 */
    border-radius: 5px; /* 可以根据需要调整圆角 */
}

.view-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffa0a8;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    opacity: 0; /* 初始状态下按钮不可见 */
    transition: opacity 0.3s ease; /* 添加过渡效果 */
}

.image:hover .view-button {
    opacity: 1; /* 鼠标悬停时按钮可见 */
}
#game, #container {
    padding: 20px;
    margin: 20px auto;
    max-width: 800px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 5px;
}
#game{
    height: 160vh;
}
p{
    padding: 1.5vh;
    margin:1vh;
}
h1,h2, h3{
    color: #ffa0a8;
    margin: 15px 0;
}
h1, h2{
    text-align: center;
}
footer {
    color: #fff;
    text-align: center;
    padding: 20px 5px;
    background-color: #ffa0a8;
    width: 100%;
    position: fixed;
    bottom: 0;
}
#game a{
    display: inline-block;
    background-color: #ffa0a8;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

#game a:hover, .button:hover {
    background-color: #ffcfd3;
}
#livingroom , #bathroom,#kitchen,#bedroom{
    display: flex;
    padding: 1rem;
}

#f1,#f2,#f3,#f4 {
    flex: 1;
}
#f1 h3,#f2 h3,#f3 h3,#f4 h3{
    padding-left: 1.2rem;
} 
#image1,#image2,#image3,#image4 {
    flex: 1;
    padding: 1rem;
    width: 50%;
}

#image1 img ,#image2 img,#image3 img,#image4 img{
    max-width: 100%;
    height: auto; /* 确保图片按比例缩放 */
}

footer p {
    margin: 0; /* 移除默认的段落外边距 */
}

@media (max-width: 600px) {
    body {
        display: flex;
        flex-direction: column; /* 使内容垂直排列 */
        align-items: center; /* 水平居中对齐 */
        min-height: 100vh;
        margin: 0;
        padding: 0;
    }
    .image {
        margin: 0 auto; /* Center the image horizontally */
        max-width: 100%; /* Full width of the container */
        position: relative; /* Establish a positioning context */
      ; /* Stack the images */
    }

    .image img {
      
        transform: translateX(-50%); /* Shift back by half the width of the image */
        max-width: none; /* Remove any max-width constraints */
        width: 100%; /* Set width to be auto */
        height: auto; /* Maintain aspect ratio */
        margin-left: 100%;
    }

    header{
        width: 100%;
    }
    header h1 {
        font-size: 1.5em; /* 减小标题字体大小 */
    }

    nav {
        margin: 0; /* 移除导航的外边距 */
    }

    nav a {
        font-size: 0.8em; /* 减小导航链接字体大小 */
        margin: 0.5rem; /* 减少链接间距 */
    }

   #game, #container {
        width: 90%; /* 减小宽度以适应小屏幕 */
        ; /* 减少内填充 */
    }

    #game {
        height: auto; /* 调整高度为自动，以适应内容 */
    }

    #livingroom, #bathroom, #kitchen, #bedroom {
        flex-direction: column; /* 在小屏幕上以列方式排列 */
    }
    #livingroom, #kitchen, #bedroom, #bathroom {
        display: flex;
        flex-direction: column-reverse; /* 在小屏幕上将图片放在文字上方 */
    }

    /* 调整图片区域的样式 */
    #image1, #image2, #image3, #image4 {
        order: -1; /* 将图片放置在文字上方 */
        margin-bottom: 1rem; /* 增加图片与文字之间的间距 */
    }

    /* 调整文字区域的样式 */
    #f1, #f2, #f3, #f4 {
        text-align: center; /* 文字居中对齐 */
    }
    #f1, #f2, #f3, #f4, #image1, #image2, #image3, #image4 {
        width: 100%; /* 在小屏幕上占满容器宽度 */
    }

    footer {
        position: relative; /* 在小屏幕上使脚注相对定位 */
        width: 100%; /* 脚注宽度占满屏幕 */
        text-align: center;
    }
}
