/* ==================== 基础样式重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Microsoft YaHei', 'Comic Sans MS', sans-serif;
    background: linear-gradient(135deg, #FFE4E1 0%, #E6F3FF 50%, #F0FFF0 100%);
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ==================== 屏幕管理 ==================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: linear-gradient(135deg, #FFE4E1 0%, #E6F3FF 50%, #F0FFF0 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.screen.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

/* ==================== 加载画面 ==================== */
#loading-screen {
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    padding: 20px;
}

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

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

.game-title {
    font-size: 36px;
    font-weight: bold;
    color: #FF6B9D;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.game-subtitle {
    font-size: 18px;
    color: #6B8E9F;
}

.loading-bar {
    width: 200px;
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 5px;
    overflow: hidden;
    margin: 20px auto;
}

.loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FF6B9D, #87CEEB);
    border-radius: 5px;
    animation: loading 2s ease-in-out infinite;
}

.loading-text {
    color: #6B8E9F;
    font-size: 14px;
}

/* ==================== 登录界面 ==================== */
#login-screen {
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.login-content {
    text-align: center;
    padding: 20px;
    width: 100%;
    max-width: 400px;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 40px 0;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-facebook {
    background: #1877F2;
    color: white;
}

.btn-facebook:hover {
    background: #166fe5;
    transform: scale(1.05);
}

.btn-guest {
    background: white;
    color: #666;
    border: 2px solid #ddd;
}

.btn-guest:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.btn-primary {
    background: linear-gradient(135deg, #FF6B9D, #FF8E53);
    color: white;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(255,107,157,0.4);
}

.btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-ad {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
}

.btn-large {
    padding: 18px 40px;
    font-size: 18px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.login-hint {
    color: #999;
    font-size: 12px;
}

/* ==================== 主界面 ==================== */
#main-screen {
    padding: 20px;
    z-index: 10;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255,255,255,0.8);
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

#user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #FF6B9D;
}

#user-name {
    font-weight: bold;
    color: #333;
}

.resources {
    display: flex;
    gap: 15px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.9);
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    color: #333;
}

.resource-icon {
    font-size: 18px;
}

.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-large {
    text-align: center;
}

.logo-animation {
    font-size: 100px;
    animation: pulse 2s infinite;
}

.game-title-large {
    font-size: 42px;
    color: #FF6B9D;
    margin: 20px 0 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.level-info {
    font-size: 18px;
    color: #6B8E9F;
}

.bottom-menu {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 15px;
    background: rgba(255,255,255,0.9);
    border-radius: 25px;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
}

.menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-btn:hover {
    transform: translateY(-5px);
}

.menu-icon {
    font-size: 28px;
}

.menu-text {
    font-size: 12px;
    color: #666;
}

.menu-btn-main {
    background: linear-gradient(135deg, #FF6B9D, #FF8E53);
    border-radius: 20px;
    padding: 15px 25px;
    box-shadow: 0 5px 20px rgba(255,107,157,0.4);
}

.menu-btn-main .menu-text {
    color: white;
    font-weight: bold;
}

/* ==================== 通用屏幕头部 ==================== */
.screen-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.back-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,107,157,0.1);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255,107,157,0.3);
    transform: scale(1.1);
}

.screen-title {
    flex: 1;
    text-align: center;
    font-size: 20px;
    color: #333;
    margin: 0 20px;
}

/* ==================== 弹窗样式 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: modalIn 0.3s ease;
}

.modal-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
}

.modal-text {
    color: #666;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==================== 提示信息 ==================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1002;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ==================== 动画定义 ==================== */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

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

@keyframes loading {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

@keyframes modalIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ==================== 响应式设计 ==================== */
@media (max-width: 375px) {
    .game-title {
        font-size: 28px;
    }
    
    .game-title-large {
        font-size: 32px;
    }
    
    .menu-icon {
        font-size: 24px;
    }
    
    .menu-text {
        font-size: 10px;
    }
}

@media (min-width: 768px) {
    #game-container {
        /* 为适应桌面端横屏和不同小游戏容器，移除硬编码的最大宽度 */
        width: 100%;
        margin: 0 auto;
        box-shadow: 0 0 50px rgba(0,0,0,0.1);
    }
}
