* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    transition: all 0.3s;
}

body.dark {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* 认证界面 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: white;
    border-radius: 24px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.5s ease;
}

body.dark .auth-card {
    background: #1e293b;
    color: white;
}

.auth-logo {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    font-family: 'Orbitron', monospace;
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.auth-tab.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s;
}

body.dark .auth-form input {
    background: #334155;
    border-color: #475569;
    color: white;
}

.auth-btn {
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
}

.auth-tip {
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 1rem;
}

.hidden {
    display: none;
}

/* 主应用 */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
}

body.dark .sidebar {
    background: rgba(30,41,59,0.95);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Orbitron', monospace;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 16px;
}

body.dark .user-info {
    background: #334155;
}

.avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

body.dark .nav-item {
    color: #cbd5e1;
}

.nav-item:hover, .nav-item.active {
    background: linear-gradient(135deg, #667eea20, #764ba220);
    color: #667eea;
}

.logout-btn, .theme-toggle-btn {
    padding: 0.75rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.logout-btn {
    background: #ef4444;
    color: white;
}

.theme-toggle-btn {
    background: #e2e8f0;
}

body.dark .theme-toggle-btn {
    background: #334155;
    color: white;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    border-radius: 16px;
}

body.dark .top-bar {
    background: rgba(30,41,59,0.5);
}

.stats-badge {
    display: flex;
    gap: 1.5rem;
    font-weight: 600;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

body.dark .stat-card {
    background: #1e293b;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
}

/* 游戏界面 */
.game-container {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

body.dark .game-container {
    background: #1e293b;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

#gameCanvas {
    background: #1a1a2e;
    border-radius: 16px;
    display: block;
    margin: 0 auto;
    cursor: pointer;
}

.game-controls {
    margin-top: 1rem;
    text-align: center;
}

.game-btn {
    padding: 0.75rem 1.5rem;
    margin: 0 0.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transition: transform 0.2s;
}

.game-btn:hover {
    transform: translateY(-2px);
}

.game-tip {
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.875rem;
}

/* 画廊 */
.gallery-controls {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.gallery-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.image-viewer {
    text-align: center;
    margin: 1.5rem 0;
}

#currentImage {
    max-width: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.history-item {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
    position: relative;
}

.history-item:hover {
    transform: scale(1.05);
}

.history-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.history-item .delete-history {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* 成就网格 */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.achievement-card {
    background: white;
    padding: 1rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.2s;
}

body.dark .achievement-card {
    background: #1e293b;
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.achievement-icon {
    font-size: 3rem;
}

.activity-list {
    list-style: none;
    margin-top: 1rem;
}

.activity-list li {
    padding: 0.75rem;
    background: white;
    margin-bottom: 0.5rem;
    border-radius: 12px;
}

body.dark .activity-list li {
    background: #1e293b;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
        padding: 1rem 0.5rem;
    }
    
    .sidebar span:not(.logo-icon) {
        display: none;
    }
    
    .user-details {
        display: none;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
}