:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 70px;
    --nav-height: 50px;
    --primary-gradient: linear-gradient(90deg, #00d2ff 0%, #3a7bd5 100%);
}

body {
    background-color: #f8f9fa;
    overflow-x: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- 顶部导航优化 --- */
.navbar {
    height: var(--nav-height);
    background: var(--primary-gradient) !important;
    z-index: 1050; /* 确保在侧边栏之上 */
    padding: 0;
}

.search-container {
    max-width: 25%;
    flex-grow: 1;
}

.search-input {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 20px;
    height: 34px;
    font-size: 0.9rem;
    padding-left: 35px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: none;
    color: white;
}

/* --- 侧边栏结构 --- */
#sidebar-wrapper {
    width: var(--sidebar-width);
    height: calc(100vh - var(--nav-height));
    position: fixed;
    top: var(--nav-height);
    left: 0;
    background: #fff;
    border-right: 1px solid #eef0f2;
    transition: transform 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1040;
}

#page-content-wrapper {
    width: 100%;
    padding-left: var(--sidebar-width);
    padding-top: var(--nav-height);
    transition: padding 0.3s ease;
    min-height: 100vh;
}

/* --- PC端收缩状态 --- */
@media (min-width: 992px) {
    body.sb-collapsed #sidebar-wrapper {
        width: var(--sidebar-collapsed-width);
    }

    body.sb-collapsed #page-content-wrapper {
        padding-left: var(--sidebar-collapsed-width);
    }

    body.sb-collapsed .sidebar-text {
        display: none !important;
    }

    body.sb-collapsed .collapsed-visible {
        display: block !important;
    }
}

/* --- 移动端响应式核心 --- */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        transform: translateX(-100%); /* 默认隐藏 */
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    #page-content-wrapper {
        padding-left: 0; /* 移动端内容铺满 */
    }

    body.sb-open #sidebar-wrapper {
        transform: translateX(0); /* 展开 */
    }

    /* 移动端遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
    }

    body.sb-open .sidebar-overlay {
        display: block;
    }

    /* 默认隐藏或放在下行 */
    .mobile-search-toggle {
        display: block !important;
    }
}

/* 游戏卡片 */
.game-card {
    border: none;
    border-radius: 12px;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.square-container {
    width: 100%;
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.square-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-link {
    padding: 10px 20px;
    color: #5f6368;
    text-decoration: none;
    display: flex;
    align-items: center;
    border-radius: 0 25px 25px 0;
    margin: 2px 10px 2px 0;
}

.sidebar-link:hover, .sidebar-link.active {
    background-color: #e8f0fe;
    color: #1a73e8;
}


/* 小 Logo 样式 */
.game-logo-sm {
    width: 24px;   /* 对应原图标大小 */
    height: 24px;
    object-fit: cover; /* 确保图片不拉伸 */
    border-radius: 4px; /* 轻微圆角 */
    flex-shrink: 0; /* 防止在窄容器中被挤压 */
}

/* 侧边栏收缩时，修正 Logo 的居中展示 */
body.sb-collapsed .game-logo-sm {
    margin-right: 0 !important; /* 收缩时去掉边距，让 Logo 居中 */
}