/* 响应式设计样式 */

/* 平板设备 */
@media screen and (max-width: 1024px) {
    #gameContainer {
        max-width: 100%;
        border-radius: 0;
        height: 100vh;
    }

    #gameHeader h1 {
        font-size: 2rem;
    }

    #gameCanvas {
        max-width: 90%;
        max-height: 60vh;
    }

    .btn {
        min-width: 180px;
        padding: 10px 25px;
    }
}

/* 手机设备 */
@media screen and (max-width: 768px) {
    body {
        overflow: hidden;
    }

    #gameContainer {
        height: 100vh;
        min-height: 100vh;
    }

    #gameHeader {
        padding: 15px;
    }

    #gameHeader h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    #gameStats {
        flex-direction: row;
        gap: 8px;
        font-size: 1rem;
    }

    #gameStats span {
        padding: 8px 12px;
    }

    /* 模式选择界面全屏显示 - gameHeader通过JS隐藏 */
    #modeSelectionScreen {
        top: 0;
        height: 100%;
        padding: 20px 10px;
        overflow-y: auto;
        justify-content: flex-start;
    }

    /* 主菜单保持原有布局，避免滚动问题 */
    #menuScreen {
        top: 0;
        height: 100%;
    }

    /* 游戏结束界面需要适当调整 */
    #gameOverScreen {
        top: 90px;
        height: calc(100% - 90px);
    }

    /* 游戏界面保持全屏，因为GameStats会隐藏 */
    #gameScreen {
        top: 0;
        height: 100%;
    }

    #gameCanvas {
        width: 95%;
        max-width: 400px;
        height: auto;
        max-height: 50vh;
    }

    .menu-buttons {
        width: 100%;
        padding: 0 20px;
        padding-bottom: 20px;
    }

    .btn {
        width: 100%;
        max-width: 280px;
        padding: 15px 20px;
        font-size: 1rem;
    }

    #gameControls {
        flex-direction: row;
        gap: 15px;
        margin-top: 15px;
        justify-content: center;
        flex-wrap: wrap;
    }

    #gameControls .btn {
        flex: 1;
        min-width: 120px;
        max-width: 180px;
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    /* 隐藏触屏控制，使用手势操作 */
    .mobile-only {
        display: none !important;
    }

    /* Canvas尺寸由JavaScript动态控制 */
}

/* 小屏手机 */
@media screen and (max-width: 480px) {
    #gameHeader h1 {
        font-size: 1.5rem;
    }

    /* 小屏手机模式选择界面全屏显示 */
    #modeSelectionScreen {
        top: 0;
        height: 100%;
        padding: 20px 10px;
        overflow-y: auto;
        justify-content: flex-start;
    }

    /* 主菜单保持原有布局 */
    #menuScreen {
        top: 0;
        height: 100%;
    }

    #gameOverScreen {
        top: 80px;
        height: calc(100% - 80px);
    }

    /* 游戏界面保持全屏 */
    #gameScreen {
        top: 0;
        height: 100%;
    }

    #gameStats {
        font-size: 0.9rem;
    }

    #gameCanvas {
        max-width: 350px;
        max-height: 45vh;
    }

    #gameControls .btn {
        min-width: 100px;
        max-width: 140px;
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .btn {
        padding: 12px 15px;
        font-size: 0.9rem;
    }



    #finalScore {
        font-size: 1.2rem;
        padding: 12px 20px;
    }

    #finalScoreValue {
        font-size: 1.5rem;
    }
}

/* 横屏模式优化 */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #gameContainer {
        flex-direction: row;
    }

    #gameHeader {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        width: 200px;
        height: 100%;
        border-bottom: none;
        border-right: 2px solid var(--primary-color);
    }

    #gameHeader h1 {
        font-size: 1.5rem;
        writing-mode: horizontal-tb;
        transform: rotate(-90deg);
        margin: 20px 0;
    }

    #gameStats {
        flex-direction: row;
        gap: 10px;
        writing-mode: horizontal-tb;
    }

    #gameMain {
        flex: 1;
    }

    #gameCanvas {
        max-height: 80vh;
        max-width: 60vw;
    }

    /* 移动端横屏模式不再需要虚拟按键 */
}

/* 高分辨率屏幕优化 */
@media screen and (min-width: 1200px) {
    #gameContainer {
        max-width: 1000px;
    }

    #gameHeader h1 {
        font-size: 3rem;
    }

    #gameStats {
        font-size: 1.2rem;
    }

    #gameCanvas {
        width: 800px;
        height: 600px;
    }

    .btn {
        min-width: 220px;
        padding: 15px 35px;
        font-size: 1.2rem;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #2a2a2a 100%);
        --secondary-color: #000000;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .glow-animation,
    .loading::after {
        animation: none;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
        color: black;
    }

    #gameContainer {
        box-shadow: none;
        background: white;
        border: 2px solid black;
    }

    .btn {
        display: none;
    }
}