/* === 超紧凑·高级动态光影·全宽固定布局 (底部导航栏极致扁，文字极致小) === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(145deg, #ecf5fa 0%, #daeaf5 50%, #e8f0f8 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    color: #1a2835;
    font-size: 7.5px;
    line-height: 1.25;
    letter-spacing: 0.1px;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
    -webkit-transform: none;
    transform: none;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== 蓝色小球背景画布 ===== */
#colorful-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.8;
    background: transparent;
}

/* ===== 高级动态线条背景 ===== */
.dynamic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.dynamic-beam {
    position: absolute;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(70, 160, 255, 0.3),
        rgba(120, 200, 255, 0.45),
        rgba(70, 160, 255, 0.3),
        transparent
    );
    height: 1.5px;
    width: 150%;
    animation: beamFlow 12s infinite cubic-bezier(0.45, 0, 0.55, 1);
    opacity: 0.6;
    filter: blur(0.4px);
}

.dynamic-beam:nth-child(1) { top: 15%; left: -20%; }
.dynamic-beam:nth-child(2) { top: 35%; left: -15%; animation-delay: 3s; }
.dynamic-beam:nth-child(3) { top: 60%; left: -20%; animation-delay: 6s; }
.dynamic-beam:nth-child(4) { top: 82%; left: -18%; animation-delay: 9s; }

@keyframes beamFlow {
    0% { transform: translateX(-120%) skewX(-12deg); }
    100% { transform: translateX(280%) skewX(-12deg); }
}

.dynamic-vertical {
    position: absolute;
    background: linear-gradient(180deg, 
        transparent, 
        rgba(50, 150, 250, 0.2),
        rgba(100, 190, 255, 0.3),
        rgba(50, 150, 250, 0.2),
        transparent
    );
    width: 1px;
    height: 150%;
    animation: verticalFlow 15s infinite ease-in-out;
    opacity: 0.5;
    filter: blur(0.2px);
}

.dynamic-vertical:nth-child(5) { left: 20%; animation-delay: 1s; }
.dynamic-vertical:nth-child(6) { left: 45%; animation-delay: 4s; }
.dynamic-vertical:nth-child(7) { left: 70%; animation-delay: 2.5s; }
.dynamic-vertical:nth-child(8) { left: 90%; animation-delay: 6s; }

@keyframes verticalFlow {
    0% { transform: translateY(-120%) skewY(-8deg); }
    100% { transform: translateY(280%) skewY(-8deg); }
}

.dynamic-particle {
    position: absolute;
    width: 1.5px;
    height: 1.5px;
    background: rgba(120, 200, 255, 0.6);
    border-radius: 50%;
    animation: particleGlow 4s infinite alternate;
}
.dynamic-particle:nth-child(9) { top: 20%; left: 25%; }
.dynamic-particle:nth-child(10) { top: 50%; left: 60%; width: 2px; height: 2px; }
.dynamic-particle:nth-child(11) { top: 75%; left: 40%; }
.dynamic-particle:nth-child(12) { top: 30%; left: 80%; }

@keyframes particleGlow {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 0.8; transform: scale(1.3); }
}

.dynamic-glow {
    position: absolute;
    width: 40%;
    height: 25%;
    background: radial-gradient(circle at center, rgba(80, 180, 255, 0.05) 0%, transparent 70%);
    animation: glowPulse 10s infinite;
}
.dynamic-glow:nth-child(13) { top: 10%; left: 20%; }

@keyframes glowPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.4; }
}

/* 确保所有固定和滚动区域都在小球和光束之上 */
.fixed-header, .pull-refresh-container, .scroll-area, .fixed-footer {
    position: relative;
    z-index: 2;
}

/* ===== 固定头部容器 ===== */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    pointer-events: auto;
    width: 100%;
}

/* 顶部导航栏 */
.navbar {
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    padding: 0 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    width: 100%;
}

.navbar-title {
    font-size: 10px;
    font-weight: 630;
    color: #0d1c2e;
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.games-count {
    font-size: 7.5px;
    font-weight: 480;
    color: #5b738b;
    margin-left: 2px;
}

.search-container {
    position: relative;
    width: 110px;
}

.search-input {
    width: 100%;
    padding: 4px 8px 4px 22px;
    font-size: 9px;
    border: none;
    border-radius: 14px;
    background-color: #eef2f6;
    outline: none;
    color: #1a2835;
}

.search-input:focus {
    background-color: #e6ecf2;
    box-shadow: 0 0 0 2px rgba(80, 160, 240, 0.2);
}

.search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #6f8595;
    font-size: 9px;
}

/* 商家入驻 */
.merchant-banner {
    height: 28px;
    background: rgba(245, 247, 250, 0.9);
    backdrop-filter: blur(18px) saturate(200%);
    -webkit-backdrop-filter: blur(18px) saturate(200%);
    border: 0.8px solid rgba(150, 175, 195, 0.55);
    border-left: none;
    border-right: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2e3c;
    font-size: 9px;
    font-weight: 560;
    text-decoration: none;
    width: 100%;
}

.merchant-banner i {
    margin-right: 4px;
    font-size: 10px;
    color: #3e5a70;
}

/* ===== 固定底部容器 ===== */
.fixed-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    pointer-events: auto;
    width: 100%;
}

/* ===== 底部导航栏 - 极致扁，极致小 ===== */
.bottom-nav {
    height: 52px; /* 更扁：58px → 52px */
    background: rgba(230, 235, 240, 0.75);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-top: 1px solid rgba(160, 170, 180, 0.3);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.04);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-top: 0;
    width: 100%;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-decoration: none;
    color: #6b7a8a;
    font-size: 7px; /* 更小：7.5px → 7px */
    padding: 2px 0 4px 0; /* 更扁：3/5 → 2/4 */
    flex: 1;
    gap: 0.5px; /* 间隙更小 */
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    border-radius: 16px 16px 0 0; /* 更小：18px → 16px */
    margin: 0 0.5px;
    height: 100%;
    position: relative;
    background: transparent;
    border: none;
    transform: translateY(0);
    box-shadow: none;
}

/* 工坊按钮 - 向上凸起 */
.bottom-nav .nav-item.active {
    color: #1e3a5f;
    font-weight: 600;
    background: #ffffff;
    transform: translateY(-5px); /* 更小：-6px → -5px */
    box-shadow: 
        0 -2px 4px -2px rgba(0, 0, 0, 0.1),
        0 2px 6px -4px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-bottom: none;
    z-index: 10;
}

.bottom-nav .nav-icon {
    font-size: 16px; /* 更小：18px → 16px */
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(255,255,255,0.5));
    color: #5e6f7e;
    transition: color 0.2s;
}

.bottom-nav .nav-item.active .nav-icon {
    color: #1e3a5f;
}

.bottom-nav .nav-item:not(.active) {
    background: transparent;
    box-shadow: none;
    border: none;
    transform: translateY(0);
    color: #7c8a9a;
}

/* ===== 下拉刷新指示器 ===== */
.pull-refresh-container {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    z-index: 999;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

.refresh-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 0;
    background: transparent;
    color: #2a405e;
    overflow: hidden;
    transition: height 0.1s ease;
    pointer-events: none;
}

.refresh-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 50px;
    padding: 5px 18px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 12px 24px -8px rgba(50, 80, 140, 0.2);
    margin-bottom: 10px;
}

.refresh-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-top-color: #2e5aaf;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 3px;
}

.refresh-text {
    font-size: 8.5px;
    font-weight: 600;
    color: #1e3b6b;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 可滚动的内容区域 ===== */
.scroll-area {
    position: fixed;
    top: 60px;
    bottom: 52px; /* 与底部导航高度52px匹配 */
    left: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 2;
    padding: 5px;
    background: transparent;
}

/* 游戏库存容器 */
.games-container {
    width: 100%;
    position: relative;
    z-index: 2;
}

/* 分类卡片样式 */
.category-container {
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 0.8px solid rgba(200, 215, 230, 0.7);
    box-shadow: 0 4px 10px rgba(0, 20, 40, 0.03);
    width: 100%;
}

.category-header {
    padding: 5px 6px;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 0.8px solid rgba(210, 225, 240, 0.7);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.category-title {
    font-size: 10px;
    font-weight: 630;
    color: #0e1c2a;
    display: flex;
    align-items: center;
    gap: 4px;
}

.category-icon-png {
    width: 14px;
    height: 14px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAsQAAALEBxi1JjQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAFcSURBVEiJ7dS9LwRRFMfxz+5qJJoN0ShEo9AIRSGKp1AolEKjUPEXqBQKjULDK0qNQkQhCBJPSChEQ0J4hJgfj82s2Z2d2Z3sjjWfyW3m3HvO/cy9c++9QlEUqkQjWoJ2A99R5R3gGT24wxM+cIYjvGMSSxjGDFZwjhvc4wxL6AlKUY9RXOET51jHmI8bwzy2cYB3vGABXf5+i3u8YB6tqCvhDE7wit6CbtxgEs24wTlGUZ+Xp9CGcZzhFb8xUcA9rBE/6b/sFW1YzxNvCOYxl9lzhj0p0JIn3hXMIlVyh6lMvBvHyZ5n8m71JMXvg2S5I2RlT5L8OnnKE39hHn0ZnyiG0hN/IDf5s38u3TjMcFkKLV1Wg5YMyi9ewyT6cJ5P/R+lYz5m4i/lH32oDp8beM/8mEEN3iQqS4z7RwWUYh+vOEXYPXzAHnZwgl2s5vmKuj8Q/AM/geN4AS2k+J4U+c8fAAAAAElFTkSuQmCC');
}

.category-count {
    background-color: rgba(225, 235, 245, 0.9);
    color: #2a4b6a;
    font-size: 7.5px;
    font-weight: 560;
    border-radius: 14px;
    padding: 1px 5px;
    border: 0.3px solid rgba(140, 175, 200, 0.4);
}

.category-meta {
    display: flex;
    align-items: center;
    gap: 4px;
}

.category-tags {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(230, 245, 255, 0.6);
    padding: 1.5px 4px;
    border-radius: 16px;
    border: 0.4px solid rgba(100, 170, 220, 0.3);
    backdrop-filter: blur(4px);
}

.category-tag-icon {
    font-size: 6.5px;
    color: #3a7ca5;
}

.category-tag-text {
    font-size: 6.5px;
    font-weight: 540;
    color: #1d5b8e;
}

.category-type {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(240, 245, 250, 0.7);
    padding: 1.5px 4px;
    border-radius: 16px;
    border: 0.4px solid rgba(120, 140, 165, 0.2);
}

.category-type-icon {
    font-size: 6.5px;
    color: #4f6f8f;
}

.category-type-text {
    font-size: 6.5px;
    font-weight: 500;
    color: #3c5a75;
}

.category-toggle {
    color: #6f8a9c;
    font-size: 10px;
    margin-left: 3px;
    transition: transform 0.2s;
}

.category-container .games-grid {
    max-height: 2800px;
    padding: 6px;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.2s ease, padding 0.15s ease, opacity 0.15s ease;
    overflow: hidden;
}

.category-container.collapsed .games-grid {
    max-height: 0 !important;
    padding: 0 6px !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.category-container.collapsed .category-toggle {
    transform: rotate(180deg);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    overflow: hidden;
}

.game-card {
    background: rgba(255, 255, 255, 0.95);
    border: 0.8px solid rgba(0, 0, 0, 0.28);
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: inherit;
    display: block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.01);
    backdrop-filter: blur(2px);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.22s cubic-bezier(0.2, 0.9, 0.3, 1), transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
    width: 100%;
}

.game-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.game-card:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.45);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 12px rgba(40, 100, 150, 0.06);
}

.game-icon {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    background-color: rgba(220, 235, 245, 0.7);
    background-size: cover;
    background-position: center;
    position: relative;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.15);
}

.game-playtime {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background-color: rgba(10, 30, 45, 0.8);
    color: #fff;
    font-size: 5.5px;
    padding: 1px 3px;
    font-weight: 450;
}

.game-info {
    padding: 4px 3px 3px 3px;
}

.game-title-row {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 2px;
}

.game-png-icon {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.game-title {
    font-size: 7.5px;
    font-weight: 600;
    color: #152b3c;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    flex: 1;
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 2px;
}

.game-tag {
    background-color: rgba(235, 245, 250, 0.9);
    color: #4e6a7c;
    font-size: 5.5px;
    padding: 1px 3px;
    border: 0.2px solid rgba(170, 195, 215, 0.5);
}

.game-details {
    display: flex;
    justify-content: space-between;
    font-size: 5.5px;
    color: #728b9b;
    align-items: center;
    padding-top: 1.5px;
    border-top: 0.5px dashed rgba(200, 220, 235, 0.8);
}

.game-status {
    position: absolute;
    top: 2px;
    left: 2px;
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 5px;
    padding: 1px 4px;
    font-weight: 500;
}

.status-installed { background-color: rgba(31, 94, 58, 0.9); }
.status-update { background-color: rgba(184, 94, 26, 0.9); }

.no-results {
    text-align: center;
    padding: 25px 12px;
    color: #4d6a80;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 0.5px solid rgba(180, 210, 235, 0.6);
}

/* 响应式 */
@media (min-width: 768px) {
    body {
        max-width: 100%;
        border-left: none;
        border-right: none;
        margin: 0;
    }
    .fixed-header,
    .fixed-footer,
    .pull-refresh-container,
    .scroll-area {
        max-width: 100%;
        left: 0;
        transform: none;
    }
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
}

@media (min-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
}

/* 320px及以下时更扁 */
@media (max-width: 320px) {
    .bottom-nav {
        height: 48px; /* 更扁：54px → 48px */
    }
    .bottom-nav .nav-item {
        font-size: 6.5px; /* 更小：7px → 6.5px */
        padding: 1.5px 0 3px 0; /* 更扁：2/4 → 1.5/3 */
    }
    .bottom-nav .nav-icon {
        font-size: 15px; /* 更小：16px → 15px */
    }
}