body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #f4f4f4;
    padding: 1rem;
    text-align: center;
    position: relative;
}

#dark-mode-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.app-card {
    background-color: #f4f4f4;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center; /* 水平居中 */
    justify-content: center; /* 垂直居中 */
    text-align: center;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    aspect-ratio: 4 / 3;
    width: 100%;
    box-sizing: border-box;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.app-icon-container {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.app-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 17%;
}

.app-title {
    font-weight: bold;
    font-size: 0.9em;
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 10px;
}

.app-description {
    font-size: 0.9em;
    color: #666;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #f0f0f0;
}

body.dark-mode header {
    background-color: #2a2a2a;
}

body.dark-mode .app-card {
    background-color: #2a2a2a;
}

body.dark-mode .app-card:hover {
    background-color: #3a3a3a;
}

body.dark-mode .app-description {
    color: #aaa;
}

/* Responsive design */
@media (max-width: 768px) {
    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 15px;
        padding: 15px;
    }

    main {
        padding: 15px;
    }

    .app-card {
        padding: 10px;
    }

    .app-icon-container {
        width: 50%;  /* 在较小屏幕上稍微减小图标大小 */
        height: 50%;
    }

    .app-title {
        font-size: 0.8em;
    }

    .app-description {
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
        padding: 10px;
    }

    main {
        padding: 10px;
    }

    .app-icon-container {
        width: 40%;  /* 在更小的屏幕上进一步减小图标大小 */
        height: 40%;
    }

    .app-title {
        font-size: 0.7em;
    }

    .app-description {
        font-size: 0.7em;
    }
}

/* Platform toggle styles */
.platform-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.platform-toggle button {
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border: none;
    background-color: #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.platform-toggle button.active {
    background-color: #007bff;
    color: white;
}

body.dark-mode .platform-toggle button {
    background-color: #333;
    color: #f0f0f0;
}

body.dark-mode .platform-toggle button.active {
    background-color: #0056b3;
}

/* 在文件末尾添加以下样式 */

footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 0px solid rgba(0, 0, 0, 0.1);
    font-size: 0.9em;
    color: #666;
}

footer p {
    margin-bottom: 10px;
}

footer nav {
    margin-top: 5px;
}

footer a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #333;
    text-decoration: underline;
}

footer nav a {
    margin: 0 10px;
}

@media (max-width: 768px) {
    footer {
        font-size: 0.8em;
    }
}

/* 确保内容区域有足够的最小高度，使页脚始终位于底部 */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* Responsive design */
@media (max-width: 1200px) {
    .app-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 400px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
}