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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    transition: background 0.3s, color 0.3s;
}

body.dark-mode {
    background: #1a1a2e;
    color: #e0e0e0;
}

header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 1rem 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: background 0.3s;
}

nav ul li a:hover {
    background: rgba(255,255,255,0.2);
}

.hamburger {
    display: none;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
}

.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    border-radius: 0 0 50px 50px;
    margin-bottom: 2rem;
}

body.dark-mode .hero {
    background: linear-gradient(135deg, #16213e, #0f3460);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

body.dark-mode .hero h1 {
    color: #e0e0e0;
}

.hero p {
    font-size: 1.2rem;
    color: #666;
}

body.dark-mode .hero p {
    color: #b0b0b0;
}

.search-filter {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.search-bar input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: 2px solid #ddd;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-bar input:focus {
    border-color: #667eea;
}

.search-bar button {
    padding: 0.8rem 1.5rem;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.search-bar button:hover {
    background: #5a67d8;
}

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filters select {
    padding: 0.8rem 1.2rem;
    border: 2px solid #ddd;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    background: #fff;
    cursor: pointer;
}

body.dark-mode .filters select {
    background: #2d3748;
    color: #e0e0e0;
    border-color: #4a5568;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}

.card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

body.dark-mode .card {
    background: #2d3748;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-content h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #333;
}

body.dark-mode .card-content h3 {
    color: #e0e0e0;
}

.card-desc {
    color: #666;
    margin-bottom: 0.8rem;
    flex: 1;
}

body.dark-mode .card-desc {
    color: #b0b0b0;
}

.card-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stars {
    color: #f1c40f;
    font-size: 1.2rem;
}

.rating-num {
    color: #888;
    font-size: 0.9rem;
}

.card-category {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.download-btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    font-weight: 600;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
}

.hot-recommend {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}

.hot-recommend h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

body.dark-mode .hot-recommend h2 {
    color: #e0e0e0;
}

.hot-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hot-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

body.dark-mode .hot-item {
    background: #2d3748;
}

.hot-item:hover {
    transform: translateX(10px);
}

.hot-rank {
    font-size: 1.5rem;
}

.hot-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.hot-downloads {
    color: #888;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 2rem;
    background: #333;
    color: #fff;
    margin-top: 2rem;
}

body.dark-mode footer {
    background: #0d0d1a;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 响应式 */
@media (max-width: 768px) {
    nav ul {
        display: none;
        flex-direction: column;
        background: rgba(102,126,234,0.9);
        position: absolute;
        top: 60px;
        right: 0;
        width: 200px;
        padding: 1rem;
        border-radius: 0 0 10px 10px;
    }
    nav ul.active {
        display: flex;
    }
    .hamburger {
        display: block;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* Admin styles */
.admin-panel, .login-form {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

body.dark-mode .admin-panel, body.dark-mode .login-form {
    background: #2d3748;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
    margin-bottom: 2rem;
}

.admin-form input {
    padding: 0.8rem 1.2rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
}

.admin-form button {
    padding: 0.8rem;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.8rem;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

body.dark-mode th, body.dark-mode td {
    border-color: #4a5568;
}

th {
    background: #667eea;
    color: #fff;
}

.error {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.success {
    color: #2ecc71;
    margin-bottom: 1rem;
}

#editModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    z-index: 200;
    max-width: 500px;
    width: 90%;
}

body.dark-mode #editModal {
    background: #2d3748;
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 300;
    transition: background 0.3s;
}

.theme-toggle:hover {
    background: #5a67d8;
}