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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.main-container {
    display: flex;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 登录模态框 */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 10px;
}

.modal-subtitle {
    color: #666;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: white;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group select {
    cursor: pointer;
}

.btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.login-hint {
    text-align: center;
    margin-top: 15px;
    color: #999;
    font-size: 0.9rem;
}

.login-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.login-warning p {
    color: #856404;
    font-size: 0.95rem;
    margin: 0;
    font-weight: bold;
}

.login-warning span {
    color: #c82333;
}

/* 游戏区域 */
.game-section {
    flex: 1;
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: 2rem;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#userDisplay {
    color: #667eea;
    font-weight: bold;
}

.btn-logout {
    padding: 8px 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-logout:hover {
    background: #c0392b;
}

.score-board {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.score-board div {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
}

.score-board span {
    color: #667eea;
}

.canvas-container {
    position: relative;
    background: #f0f4f8;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.1);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10;
}

.screen.hidden {
    display: none;
}

.dino-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.screen p {
    font-size: 1.3rem;
    color: #555;
    margin-bottom: 10px;
}

.game-over-text {
    font-size: 3rem;
    color: #e74c3c;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.final-score {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 15px;
}

.restart-hint {
    font-size: 1.1rem;
    color: #667eea;
}

.controls-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.key {
    background: #667eea;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 3px 0 #4a5fc1;
    transition: transform 0.1s;
}

.key:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #4a5fc1;
}

.action {
    color: #666;
    font-size: 1rem;
}

/* 排行榜侧边栏 */
.ranking-sidebar {
    width: 320px;
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 600px;
    overflow-y: auto;
}

.ranking-sidebar h3 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.ranking-header {
    display: grid;
    grid-template-columns: 50px 80px 80px 80px;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 2px solid #667eea;
    font-weight: bold;
    color: #667eea;
    font-size: 0.9rem;
}

.ranking-list {
    margin-top: 10px;
}

.ranking-item {
    display: grid;
    grid-template-columns: 50px 80px 80px 80px;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    align-items: center;
    font-size: 0.9rem;
}

.ranking-item:nth-child(1) {
    background: linear-gradient(135deg, #ffd700 0%, #ffec8b 100%);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 5px;
}

.ranking-item:nth-child(2) {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 5px;
}

.ranking-item:nth-child(3) {
    background: linear-gradient(135deg, #cd7f32 0%, #daa06d 100%);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 5px;
}

.ranking-item.current-user {
    background: #e8f0fe;
    border-radius: 8px;
}

.rank-num {
    font-weight: bold;
    color: #667eea;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
    }
    
    .ranking-sidebar {
        width: 100%;
        max-height: 300px;
    }
}

@media (max-width: 600px) {
    .game-section {
        padding: 20px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .score-board {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .controls-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .dino-icon {
        font-size: 60px;
    }
    
    .game-over-text {
        font-size: 2rem;
    }
    
    .ranking-header {
        grid-template-columns: 40px 60px 60px 60px;
        font-size: 0.8rem;
    }
    
    .ranking-item {
        grid-template-columns: 40px 60px 60px 60px;
        font-size: 0.8rem;
    }
}
