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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #667eea 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    overflow: hidden;
}

/* 登录系统样式 */
.login-page {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.login-container {
    text-align: center;
    z-index: 1;
    position: relative;
    max-width: 450px;
    width: 90%;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.login-header {
    margin-bottom: 30px;
}

.login-logo {
    margin-bottom: 20px;
}

.login-title {
    color: white;
    font-size: 2.2em;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
    font-weight: 300;
    letter-spacing: 2px;
}

.auth-form {
    text-align: left;
}

.form-title {
    color: white;
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

.form-group label {
    display: block;
    color: white;
    font-size: 0.95em;
    font-weight: 500;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1em;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border: none;
    border-radius: 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.auth-btn.primary-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.auth-btn.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.auth-btn.secondary-btn {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.auth-btn.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.guest-login {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.guest-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.guest-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.user-info {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-avatar {
    margin-bottom: 15px;
}

.avatar-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.username {
    color: white;
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.user-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.stat {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    font-weight: 500;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(45deg, #f44336, #d32f2f);
    color: white;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

/* 皮肤系统样式 */
.skin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(45deg, #9c27b0, #673ab7);
    color: white;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
    margin-bottom: 10px;
}

.skin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

.stats-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(45deg, #ff9800, #f57c00);
    color: white;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    margin-bottom: 10px;
}

.stats-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.skin-modal {
    max-width: 800px;
    width: 90%;
}

.skin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.skin-item {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(5px);
}

.skin-item:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.skin-item.selected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
}

.skin-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.skin-item.locked:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.skin-preview {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    position: relative;
    overflow: hidden;
}

.skin-name {
    color: #304b7a;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 5px;
}

.skin-description {
    color: #718096;
    font-size: 0.75em;
    line-height: 1.3;
}

.skin-lock {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
}

.skin-requirement {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(255, 193, 7, 0.9);
    color: #333;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.6em;
    font-weight: 600;
}

/* 初始页面样式 */
.start-page {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.start-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.start-content {
    text-align: center;
    z-index: 1;
    position: relative;
    max-width: 500px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.game-logo {
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: logoFloat 3s ease-in-out infinite;
}

.game-title {
    color: white;
    font-size: 2.5em;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.game-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2em;
    font-weight: 300;
    letter-spacing: 2px;
}

.start-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.menu-btn:hover::before {
    left: 100%;
}

.primary-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(255, 107, 107, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-weight: 600;
}

.game-info {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

.version {
    margin-bottom: 10px;
    font-weight: 300;
}

.features {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.feature {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    backdrop-filter: blur(5px);
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .start-content {
        max-width: 90%;
        padding: 30px 20px;
    }
    
    .game-title {
        font-size: 2em;
    }
    
    .game-subtitle {
        font-size: 1em;
    }
    
    .logo-icon {
        font-size: 3em;
    }
    
    .menu-btn {
        padding: 14px 25px;
        font-size: 1em;
    }
    
    .features {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .start-content {
        padding: 25px 15px;
    }
    
    .game-title {
        font-size: 1.8em;
    }
    
    .logo-icon {
        font-size: 2.5em;
    }
    
    .menu-btn {
        padding: 12px 20px;
        font-size: 0.9em;
    }
}

.game-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 25px;
    padding: 35px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 1400px;
    width: 100%;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    margin-top: 20px;
}

h1 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 3em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: bold;
}

.score, .high-score, .level {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    font-size: 1em;
    min-width: 100px;
    text-align: center;
}

.level-info {
    margin-bottom: 12px;
}

.level-name {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1em;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
    text-align: center;
    margin: 8px 0;
}

.level-progress {
    margin-top: 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 2.17%; /* 1/46 * 100% */
}

.progress-text {
    color: #718096;
    font-size: 0.9em;
    text-align: center;
}

/* 通关标志样式 */
.completion-badge {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border: 2px solid #ffb300;
    border-radius: 20px;
    padding: 10px 15px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    animation: badgeGlow 2s ease-in-out infinite alternate;
}

.badge-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.badge-icon {
    font-size: 1.5em;
    animation: badgeBounce 1s ease-in-out infinite;
}

.badge-text {
    color: #8b4513;
    font-weight: bold;
    font-size: 1em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.badge-time {
    color: #8b4513;
    font-size: 0.8em;
    opacity: 0.8;
}

@keyframes badgeGlow {
    0% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    }
    100% {
        box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
    }
}

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

/* 左右面板样式 */
.left-panel {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.right-panel {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.center-panel {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.left-panel {
    text-align: left;
}

.right-panel {
    text-align: left;
}

.left-panel .game-info {
    flex-direction: column;
    gap: 10px;
}

.left-panel .controls {
    flex-direction: column;
    align-items: stretch;
}

    .left-panel button {
        width: 100%;
        margin: 5px 0;
    }

#gameCanvas {
    border: 4px solid #4a5568;
    border-radius: 20px;
    background: linear-gradient(145deg, #f8fafc, #e2e8f0);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.8);
    margin: 20px 0;
    position: relative;
    max-width: 100%;
    height: auto;
    transition: all 0.3s ease;
}

#gameCanvas:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

#gameCanvas::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    border-radius: 17px;
    z-index: -1;
    opacity: 0.3;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

/* 暂停按钮特殊样式 */
#pauseBtn {
    font-size: 1.1em;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.instructions {
    background: #f7fafc;
    padding: 15px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.instructions h3 {
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.instructions p {
    margin-bottom: 6px;
    color: #718096;
    line-height: 1.4;
    font-size: 0.95em;
}

/* 虚拟操纵杆样式 */
.joystick-container {
    text-align: center;
    background: #f7fafc;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    display: block !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.joystick-container h3 {
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: bold;
}

.joystick {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 8px;
}

.joystick-base {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e2e8f0, #cbd5e0);
    border: 3px solid #a0aec0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

.joystick-stick {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(145deg, #667eea, #764ba2);
    border: 2px solid #4a5568;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.joystick-stick:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.direction-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.middle-row {
    display: flex;
    gap: 15px;
}

.dir-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border: none;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
    display: flex !important;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.dir-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(145deg, #5a67d8, #6b46c1);
}

.dir-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.dir-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 游戏失败弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    margin: 10% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header {
    background: linear-gradient(45deg, #ff4757, #ff3838);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    text-align: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 700;
}

.modal-body {
    padding: 25px;
    text-align: center;
}

.final-score {
    margin-bottom: 20px;
}

.final-score p {
    font-size: 1.2em;
    font-weight: 600;
    color: #2d3748;
    margin: 8px 0;
}

.new-record {
    background: linear-gradient(45deg, #ffa502, #ff9500);
    color: white;
    padding: 15px;
    border-radius: 15px;
    margin: 15px 0;
    animation: pulse 2s infinite;
}

.new-record p {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.game-over-message {
    color: #718096;
    font-size: 1em;
    margin: 15px 0;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.restart-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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

.close-btn {
    background: linear-gradient(45deg, #a0aec0, #718096);
    color: white;
    box-shadow: 0 4px 15px rgba(160, 174, 192, 0.3);
}

.close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(160, 174, 192, 0.4);
}

/* 弹窗动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* 弹窗响应式设计 */
@media (max-width: 600px) {
    .modal-content {
        margin: 20% auto;
        width: 95%;
        max-width: 350px;
    }
    
    .modal-header h2 {
        font-size: 1.5em;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .final-score p {
        font-size: 1.1em;
    }
    
    .modal-footer {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-btn {
        min-width: 100%;
        padding: 15px 24px;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
        gap: 25px;
    }
    
    .left-panel, .right-panel {
        flex: 0 0 auto;
        width: 100%;
        max-width: 600px;
    }
    
    .left-panel .game-info {
        flex-direction: row;
        justify-content: space-between;
        gap: 15px;
    }
    
    .left-panel .controls {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
    }
    
    .left-panel button {
        width: auto;
        margin: 0;
        padding: 12px 24px;
        font-size: 1em;
    }
    
    .joystick-container {
        margin-bottom: 20px;
        display: block !important;
    }
    
    .joystick {
        display: flex !important;
    }
    
    .right-panel {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
}

/* iPad和中等屏幕优化 */
@media (max-width: 1024px) and (min-width: 768px) {
    .game-container {
        max-width: 900px;
        padding: 25px;
    }
    
    .game-layout {
        flex-direction: column;
        gap: 25px;
    }
    
    .left-panel, .right-panel {
        flex: 0 0 auto;
        width: 100%;
        max-width: 600px;
    }
    
    .joystick-container {
        margin-bottom: 15px;
        padding: 15px;
    }
    
    .joystick-base {
        width: 120px;
        height: 120px;
    }
    
    .joystick-stick {
        width: 45px;
        height: 45px;
    }
    
    .dir-btn {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 450px;
        height: auto;
    }
    
    .right-panel {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
}

/* iPad 横屏优化 */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape),
       (min-width: 768px) and (max-width: 1366px) and (min-height: 768px) and (max-height: 1024px) {
    .game-container {
        max-width: 1200px;
        padding: 20px;
    }
    
    .game-layout {
        flex-direction: row;
        gap: 20px;
        align-items: flex-start;
    }
    
    .left-panel {
        flex: 0 0 250px;
        order: 1;
    }
    
    .center-panel {
        flex: 1;
        order: 2;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .right-panel {
        flex: 0 0 280px;
        order: 3;
        gap: 12px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 500px;
        height: auto;
    }
    
    .joystick-container {
        margin-bottom: 12px;
        padding: 10px;
    }
    
    .joystick-base {
        width: 90px;
        height: 90px;
    }
    
    .joystick-stick {
        width: 32px;
        height: 32px;
    }
    
    .dir-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .instructions {
        padding: 12px;
        font-size: 0.9em;
    }
    
    .instructions h3 {
        font-size: 1.1em;
        margin-bottom: 6px;
    }
    
    .instructions p {
        font-size: 0.85em;
        margin-bottom: 4px;
        line-height: 1.3;
    }
    
    .score, .high-score, .level {
        padding: 8px 16px;
        font-size: 1em;
        min-width: 100px;
    }
    
    .level-name {
        padding: 8px 16px;
        font-size: 1em;
        margin: 8px 0;
    }
    
    button {
        padding: 10px 20px;
        font-size: 0.95em;
    }
    
    h1 {
        font-size: 2.5em;
        margin-bottom: 15px;
    }
}

/* iPad Air 专用优化 */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) {
    .game-container {
        max-width: 1300px;
        padding: 25px;
    }
    
    .left-panel {
        flex: 0 0 280px;
    }
    
    .right-panel {
        flex: 0 0 300px;
    }
    
    #gameCanvas {
        max-width: 550px;
    }
    
    .joystick-base {
        width: 100px;
        height: 100px;
    }
    
    .joystick-stick {
        width: 35px;
        height: 35px;
    }
    
    .dir-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@media (max-width: 600px) {
    .game-container {
        margin: 20px;
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 350px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 200px;
    }
    
    .left-panel .game-info {
        flex-direction: column;
    }
    
    .left-panel .controls {
        flex-direction: column;
    }
    
    .left-panel button {
        width: 200px;
        margin: 5px 0;
    }
    
    .joystick-container {
        margin-bottom: 15px;
        padding: 10px;
    }
    
    .joystick-base {
        width: 80px;
        height: 80px;
    }
    
    .joystick-stick {
        width: 30px;
        height: 30px;
    }
    
    .dir-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* 登录系统响应式设计 */
@media (max-width: 768px) {
    .login-container {
        max-width: 95%;
        padding: 30px 20px;
    }
    
    .login-title {
        font-size: 1.8em;
    }
    
    .login-subtitle {
        font-size: 1em;
    }
    
    .form-title {
        font-size: 1.5em;
    }
    
    .form-group input {
        padding: 10px 14px;
        font-size: 0.95em;
    }
    
    .auth-btn {
        padding: 12px 20px;
        font-size: 0.95em;
    }
    
    .user-stats {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 25px 15px;
    }
    
    .login-title {
        font-size: 1.6em;
    }
    
    .form-title {
        font-size: 1.3em;
    }
    
    .auth-btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .guest-btn {
        padding: 8px 16px;
        font-size: 0.85em;
    }
}

/* iPad 横屏登录优化 */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {
    .login-container {
        max-width: 500px;
        padding: 35px;
    }
    
    .login-title {
        font-size: 2em;
    }
    
    .form-title {
        font-size: 1.6em;
    }
}

/* 皮肤系统响应式设计 */
@media (max-width: 768px) {
    .skin-modal {
        max-width: 95%;
        width: 95%;
    }
    
    .skin-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        max-height: 300px;
    }
    
    .skin-item {
        padding: 10px;
    }
    
    .skin-preview {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }
    
    .skin-name {
        font-size: 0.8em;
    }
    
    .skin-description {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    .skin-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .skin-item {
        padding: 8px;
    }
    
    .skin-preview {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .skin-name {
        font-size: 0.75em;
    }
    
    .skin-description {
        font-size: 0.65em;
    }
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.6);
    border-radius: 16px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.profile-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    color: #2d3748;
    font-weight: 600;
}

.profile-row .label {
    color: #718096;
    font-weight: 500;
    margin-right: 6px;
}
