* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

:root {
    --bg: #ffffff;
    --text: #222;
    --card-bg: #f9f9f9;
    --primary: #2563eb;
    --secondary: #10b981;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 16px;
}

.dark-mode {
    --bg: #1a1a2e;
    --text: #e0e0e0;
    --card-bg: #2d2d44;
    --primary: #60a5fa;
    --secondary: #34d399;
    --shadow: 0 4px 12px rgba(0,0,0,0.4);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* 主题模板 */
.theme-tech { --primary: #2563eb; --secondary: #10b981; }
.theme-fashion { --primary: #ec4899; --secondary: #f59e0b; }
.theme-food { --primary: #f97316; --secondary: #eab308; }

.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
}
.logo {
    font-size: 1.6rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--primary);
}
.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}
.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
}
.nav-links a:hover {
    background: var(--primary);
    color: #fff;
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.nav-actions button, .btn-login, .btn-logout {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-login, .btn-logout {
    text-decoration: none;
    display: inline-block;
}
.hamburger {
    display: none;
    background: none;
    font-size: 1.6rem;
    color: var(--text);
}
.user-greeting {
    font-size: 0.9rem;
    color: var(--secondary);
}

.hero {
    text-align: center;
    padding: 4rem 1rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}
.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}
.search-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1.5rem;
}
.search-bar input, .search-bar select {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255,255,255,0.9);
    color: #222;
}
.search-bar button {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font-weight: bold;
    cursor: pointer;
}

.stats-heatmap {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.stats-grid {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}
.stat-card {
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    flex: 1 1 150px;
}
.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}
.heatmap-container {
    margin-top: 2rem;
}
#heatmap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.heat-block {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transform: translateY(0);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}
.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.card-body {
    padding: 1rem;
}
.card-body h3 {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
}
.card-meta {
    display: flex;
    justify-content: space-between;
    margin: 0.6rem 0;
}
.category {
    background: var(--primary);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}
.rating {
    font-size: 0.9rem;
}
.card-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.tag {
    background: var(--secondary);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
}

.share-section {
    text-align: center;
    padding: 2rem;
}
.share-buttons button {
    padding: 0.5rem 1.2rem;
    margin: 0.3rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}

footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--card-bg);
    margin-top: 2rem;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}
.footer-links a {
    color: var(--text);
    text-decoration: none;
}

.admin-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.admin-login {
    max-width: 400px;
    margin: 4rem auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.admin-login input, .admin-login button {
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid #ccc;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.add-form form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.add-form input, .add-form textarea, .add-form button {
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid #ccc;
}
.item-list table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
}
.item-list th, .item-list td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
.ai-result {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        background: var(--card-bg);
        position: absolute;
        top: 60px;
        right: 0;
        width: 200px;
        box-shadow: var(--shadow);
        border-radius: 0 0 8px 8px;
    }
    .nav-links.active {
        display: flex;
    }
    .hamburger {
        display: block;
    }
    .hero h1 {
        font-size: 1.6rem;
    }
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }
}