/* CSS 变量定义 - 统一配色方案 */
:root {
    --color-light: #eeeeee;
    --color-primary: #00adb5;
    --color-dark: #393e46;
    --color-darker: #222831;
    
    /* 衍生颜色 */
    --color-primary-hover: #0099a1;
    --color-primary-light: rgba(0, 173, 181, 0.1);
    --color-primary-border: rgba(0, 173, 181, 0.3);
    
    /* 背景色 */
    --bg-light: #eeeeee;
    --bg-white: #ffffff;
    --bg-dark: #393e46;
    --bg-darker: #222831;
    
    /* 文本颜色 */
    --text-primary: #222831;
    --text-secondary: #393e46;
    --text-light: #eeeeee;
    --text-muted: #6a737d;
    
    /* 边框颜色 */
    --border-light: #eeeeee;
    --border-dark: #393e46;
}

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

html {
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    /* 移动端优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* background-image: url('https://game.shelter.net.cn/manosaba/game/background/Still_001_001.webp'); */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

.layout::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    z-index: 1;
    pointer-events: none;
}

@media (max-width: 768px) {
    .layout {
        background-image: none;
        background-attachment: scroll;
    }
    .layout::before {
        display: none;
    }
}

.layout > * {
    position: relative;
    z-index: 3;
}

/* Header 样式 */
.header {
    z-index: 100;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--bg-darker);
    color: var(--text-light);
    padding: 0.75rem 0; /* 减小上下内边距 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
    height: 60px; /* 固定高度以匹配 React 版本 */
    display: flex;
    align-items: center;
}

.header.nav-hidden {
    transform: translateY(-100%);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.logo {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.25rem; /* 匹配 React 版本的 1.25rem */
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white; /* 这里的文字是白色 */
    font-weight: 600;
}

.logo-img {
    width: 28px;
    height: 28px;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 0.875rem; /* 14px */
}

.nav-link:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

/* 移动端菜单按钮样式 */
.mobile-header-actions {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger {
    width: 24px;
    height: 18px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -7px); }

/* Main Content 样式调整 */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--bg-white); /* 匹配 React 版本的白色背景 */
    border-radius: 8px;
    margin-top: calc(60px + 1rem); /* 60px header + 1rem 间距 */
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(34, 40, 49, 0.1);
    backdrop-filter: blur(5px);
}

@media (max-width: 768px) {
    .header {
        height: 50px;
    }
    .header-content {
        padding: 0 1rem;
    }
    .nav { display: none; }
    .mobile-header-actions { display: flex; }
    .main-content {
        padding: 1rem;
        margin-top: calc(50px + 0.5rem);
        margin-bottom: calc(60px + 0.5rem);
        border-radius: 0;
        box-shadow: none;
    }
}

/* 游戏卡片网格 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.game-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.game-cover-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
}

.game-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-info {
    padding: 1.25rem;
    flex-grow: 1;
}

.game-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--color-darker);
}

.game-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-clamp: 3;
    -webkit-line-clamp: 3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* 移动端菜单按钮 */
.mobile-header-actions {
    display: none;
}

@media (max-width: 768px) {
    .mobile-header-actions {
        display: flex;
        align-items: center;
    }
    .nav { display: none; }
}

.mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: white;
}

.hamburger {
    width: 24px;
    height: 18px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -7px); }

/* 菜单抽屉 */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: -280px;
    bottom: 0;
    width: 280px;
    background: var(--bg-darker);
    z-index: 1000;
    transition: right 0.3s ease;
    padding: 2rem 1rem;
}

.mobile-menu-drawer.open { right: 0; }
.mobile-menu-overlay.show { display: block; }

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-nav-link {
    color: white;
    text-decoration: none;
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* 底部导航栏 */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-darker);
    padding: 0.5rem 0;
    justify-content: space-around;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-bottom-nav { display: flex; }
}

.mobile-bottom-nav.nav-hidden {
    transform: translateY(100%);
}

.mobile-nav-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 0.5rem;
    cursor: pointer;
}

/* Footer */
.layout-footer {
    background: rgba(20, 20, 30, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 1rem;
    color: white;
    text-align: center;
}
