/* 移动端优化样式 */

/* PWA 相关 */
@media screen and (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* 触摸反馈优化 */
.game-container {
    touch-action: manipulation;
}

canvas {
    /* 确保在移动设备上正确缩放 */
    max-width: 100vw;
    max-height: 70vh;
}

/* 移动端按钮优化 */
button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 24px !important;
}

/* 信息面板在小屏幕上的布局 */
@media (max-width: 480px) {
    .game-container {
        padding: 12px 16px 18px;
        border-radius: 32px;
    }
    
    canvas {
        border-radius: 24px;
        width: 100% !important;
        height: auto !important;
    }
    
    .info-panel {
        flex-direction: column;
        gap: 16px;
        padding: 12px 16px;
        border-radius: 32px;
    }
    
    .score-area {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        padding: 8px 16px;
    }
    
    .score-box, .best-box, .combo-box {
        padding: 6px 14px;
        font-size: 1.1rem;
    }
    
    .tip {
        font-size: 0.8rem;
        padding: 6px 16px;
        margin-top: 16px;
    }
}

/* 横屏模式优化 */
@media (min-width: 481px) and (max-height: 480px) {
    /* 横屏时的特殊处理 */
    body {
        padding: 10px;
    }
    
    .game-container {
        max-width: 95vw;
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* iOS Safari 特定优化 */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
    
    button {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Android Chrome 优化 */
@media all and (display-mode: fullscreen) {
    body {
        overflow: hidden;
    }
}

/* 添加触摸反馈 */
.touch-feedback {
    animation: touchPulse 0.2s ease-out;
}

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

/* 加载指示器 */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    z-index: 1000;
}

/* 隐藏地址栏（iOS） */
body.mobile-ready {
    height: 100vh;
    overflow: hidden;
}

/* 游戏结束按钮在移动端更大 */
#gameOverBtn {
    min-height: 50px !important;
    font-size: 1.2rem !important;
    padding: 14px 28px !important;
}