:root {
    --primary-color: #6a1b9a;
    --secondary-color: #f39c12;
    --text-color: #333;
    --background-color: #f4f4f4;
    --section-bg-color: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
}

.container {
    max-width: 1200px; /* 或者您想要的最大宽度 */
    margin: 0 auto;
    padding: 0 20px; /* 添加一些左右内边距 */
    width: 100%; /* 确保容器占满可用宽度 */
}

h1, h2, h3 {
    font-family: 'Fredoka One', cursive;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

h2 {
    font-size: 2rem;
    color: var(--secondary-color);
}

h3 {
    font-size: 1.5rem;
}

main {
    padding: 0;
}

/* Header Styles */
.site-header {
    background-color: var(--primary-color);
    padding: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 100;
    height: 56px;
    display: flex;
    align-items: center;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
}

.main-nav {
    height: 100%;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: 20px;
    height: 100%;
}

.main-nav ul li {
    display: flex;
    align-items: center;
    height: 100%;
}

.main-nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-nav ul li a:hover {
    color: var(--primary-color);
    background-color: white;
}

/* Mobile Menu Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002; /* 提高z-index值，确保在最上层 */
    padding: 10px; /* 增加点击区域 */
}

.hero-section {
    height: calc(100vh - 56px); /* Subtract header height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--background-color);
    width: 100%;
    padding: 10px 0;
    margin-top: 0;
}

/* Game Content Wrapper */
.game-content-wrapper {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    padding: 0 20px;
    height: 100%;
}

.game-container-wrapper {
    width: 70%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-container {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 500px;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.game-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px 15px;
    background-color: var(--section-bg-color);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.game-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 700;
}

.game-rating {
    display: flex;
    align-items: center;
}

.stars {
    display: flex;
    margin-right: 10px;
}

.star {
    color: gold;
    font-size: 1.2rem;
    margin-right: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.rating-value {
    font-weight: bold;
    font-size: 1rem;
    color: #555;
}

.game-controls {
    display: flex;
    align-items: center;
}

#fullscreen-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    transition: background 0.3s ease, transform 0.2s ease;
}

#fullscreen-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

#fullscreen-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Sidebar Recommendations */
.sidebar-recommendations {
    width: 30%;
    background-color: var(--section-bg-color);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar-game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.sidebar-game-grid .game-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    aspect-ratio: 1;
}

.sidebar-game-grid .game-item:hover {
    transform: translateY(-3px);
}

.sidebar-game-grid .game-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.gameplay-images-container {
    width: 100%;
    max-width: 800px; /* 或者您想要的最大宽度 */
    margin: 0 auto;
    padding: 15px;
}

.gameplay-images {
    width: 100%;
    border-radius: 15px;
    overflow: hidden; /* 确保圆角应用到图片 */
}

.gameplay-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 15px;
}

/* 媒体查询，用于在较小屏幕上调整样式 */
@media (max-width: 768px) {
    .gameplay-images-container {
        padding: 10px;
    }

    .gameplay-images,
    .gameplay-image {
        border-radius: 10px; /* 在移动设备上使用稍小的圆角 */
    }
    
    .game-content-wrapper {
        flex-direction: column;
    }
    
    .game-container-wrapper, 
    .sidebar-recommendations {
        width: 100%;
    }
    
    /* 移动端菜单优化 */
    .menu-toggle {
        display: block;
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1500; /* 进一步提高z-index */
        padding: 10px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: transparent;
        border: none;
        cursor: pointer;
    }
    
    .site-header {
        justify-content: flex-end;
    }
    
    .site-header .container {
        justify-content: flex-end;
        position: static; /* 修改为static，避免影响子元素定位 */
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background-color: var(--primary-color);
        transition: right 0.3s ease;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
        z-index: 1400; /* 调整z-index，确保在overlay之上 */
        overflow-y: auto;
        padding-top: 60px;
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        height: auto;
        padding: 0;
        gap: 0;
        width: 100%;
    }
    
    .main-nav ul li {
        width: 100%;
        height: auto;
        margin-bottom: 5px;
    }
    
    .main-nav ul li a,
    .menu-link {
        display: block;
        padding: 15px 20px;
        border-radius: 0;
        width: 100%;
        text-align: left;
        justify-content: flex-start;
        position: relative;
        z-index: 1401; /* 确保链接可点击 */
        cursor: pointer; /* 添加指针样式 */
        text-decoration: none; /* 确保没有下划线 */
        color: white; /* 确保文字颜色正确 */
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2); /* 添加触摸反馈 */
        touch-action: manipulation; /* 优化触摸行为 */
    }
    
    .main-nav ul li a:hover,
    .main-nav ul li a:active,
    .main-nav ul li a:focus,
    .menu-link:hover,
    .menu-link:active,
    .menu-link:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
    }
    
    .menu-link::after {
        position: absolute;
        right: 20px;
        font-size: 20px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1300; /* 调整z-index，确保在main-nav之下 */
        cursor: pointer; /* 添加指针样式提示可点击 */
    }
    
    .overlay.active {
        display: block;
    }
    
    body.menu-open {
        overflow: hidden;
    }
    
    .hero-section {
        height: calc(100vh - 56px);
    }
    
    .game-container {
        min-height: 300px;
    }
    
    /* 移动端游戏网格 */
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }
    
    .sidebar-game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

section {
    background-color: var(--section-bg-color);
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

.game-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(30, 30, 30, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    border-radius: 12px;
    opacity: 1;
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
    visibility: visible;
    cursor: default;
}

.game-mask.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.game-mask-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: white;
}

.game-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 25px;
    border-radius: 20px;
}

.mask-game-title {
    font-size: 2.2rem;
    margin-bottom: 30px;
    color: white;
    font-family: 'Fredoka One', cursive;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.play-button {
    padding: 15px 35px;
    font-size: 1.4rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.play-button:hover {
    background-color: #e67e22;
    transform: scale(1.03);
}

.play-button svg {
    margin-right: 10px;
    width: 24px;
    height: 24px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.game-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 1 / 1;
}

.game-item:hover {
    transform: translateY(-5px);
}

.game-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.game-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-item:hover .game-overlay {
    opacity: 1;
}

.game-overlay h3 {
    color: white;
    text-align: center;
    padding: 10px;
    margin-bottom: 10px;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.game-item .game-overlay h3 {
    color: white;
    text-align: center;
    padding: 10px;
    margin-bottom: 10px;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

#how-to-play {
    padding-top: 30px;
    margin: 40px auto;
    text-align: center;
}

.how-to-play-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.mode-item, .controls-info {
    background-color: var(--section-bg-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mode-item {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mode-text h3, .controls-info h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.how-to-play-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
}

ul, ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.faq-item {
    margin-bottom: 20px;
}

footer {
    background-color: var(--primary-color);
    color: white;
    padding: 40px 0;
    text-align: center;
}

footer nav ul {
    list-style-type: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

footer nav ul li {
    margin: 0 10px;
}

footer nav ul li a {
    color: white;
    text-decoration: none;
}

footer nav ul li a:hover {
    text-decoration: underline;
}

@media (min-width: 768px) {
    .mode-item {
        flex-direction: row;
        align-items: center;
    }

    .mode-text {
        flex: 1;
    }

    .how-to-play-image {
        flex: 1;
        max-width: 50%;
    }
}

@media (max-width: 768px) {
    .hero-section {
        min-height: auto;
    }

    .game-container {
        aspect-ratio: 4 / 3;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .how-to-play-content {
        flex-direction: column;
    }

    footer nav ul {
        flex-direction: column;
    }

    footer nav ul li {
        margin: 5px 0;
    }
}

@media (max-width: 480px) {
    .game-container {
        aspect-ratio: 1 / 1;
    }

    .game-grid {
        grid-template-columns: 1fr;
    }
}

/* 移动菜单容器 */
.mobile-menu-container {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background-color: var(--primary-color);
    transition: right 0.3s ease;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    overflow-y: auto;
    padding-top: 60px;
}

.mobile-menu-container.active {
    right: 0;
}

/* 移动端菜单样式 */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2100;
        padding: 10px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: transparent;
        border: none;
        cursor: pointer;
    }
    
    .main-nav {
        width: 100%;
        height: auto;
    }
    
    .main-nav ul {
        flex-direction: column;
        height: auto;
        padding: 0;
        gap: 0;
        width: 100%;
    }
    
    .main-nav ul li {
        width: 100%;
        height: auto;
        margin-bottom: 5px;
    }
    
    .main-nav ul li a {
        display: block;
        padding: 15px 20px;
        border-radius: 0;
        width: 100%;
        text-align: left;
        justify-content: flex-start;
        position: relative;
        z-index: 2001;
        cursor: pointer;
        text-decoration: none;
        color: white;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        touch-action: manipulation;
    }
    
    .main-nav ul li a:hover,
    .main-nav ul li a:active,
    .main-nav ul li a:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
    }
    
    .main-nav ul li a::after {
        content: "›";
        position: absolute;
        right: 20px;
        font-size: 20px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1900;
        cursor: pointer;
    }
    
    .overlay.active {
        display: block;
    }
    
    body.menu-open {
        overflow: hidden;
    }
    
    .hero-section {
        height: calc(100vh - 56px);
    }
    
    .game-container {
        min-height: 300px;
    }
    
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }
    
    .sidebar-game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.sidebar-game-grid p, .game-item p {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

@media (max-width: 1024px) {
    .game-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .sidebar-game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        min-height: auto;
        height: auto;
        padding: 20px 0;
    }
    
    .game-content-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-container-wrapper, 
    .sidebar-recommendations {
        width: 100%;
    }
    
    .game-container {
        aspect-ratio: 16 / 9;
        min-height: auto;
    }
    
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 10px;
        margin-top: 15px;
    }
    
    .sidebar-game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    section {
        padding: 15px !important;
        margin: 10px 0 !important;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .menu-toggle {
        display: block;
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1500;
        padding: 10px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .site-header {
        justify-content: flex-end;
    }
    
    .site-header .container {
        justify-content: flex-end;
        position: static;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background-color: var(--primary-color);
        transition: right 0.3s ease;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
        z-index: 1400;
        overflow-y: auto;
        padding-top: 60px;
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        height: auto;
        padding: 0;
        gap: 0;
        width: 100%;
    }
    
    .main-nav ul li {
        width: 100%;
        height: auto;
        margin-bottom: 5px;
    }
    
    .main-nav ul li a {
        display: block;
        padding: 15px 20px;
        border-radius: 0;
        width: 100%;
        text-align: left;
        justify-content: flex-start;
        pointer-events: auto;
        position: relative;
        z-index: 1401;
        cursor: pointer;
        text-decoration: none;
        color: white;
    }
    
    .main-nav ul li a:hover,
    .main-nav ul li a:active,
    .main-nav ul li a:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1300;
        cursor: pointer;
    }
    
    footer {
        padding: 25px 0;
    }
    
    footer nav ul {
        flex-direction: column;
    }
}