* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: #101722;
    color: #fff;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.game-shell {
    position: relative;
    width: min(100%, 1280px);
}

#gameCanvas {
    width: 100%;
    height: auto;
    display: block;
    background: #b3dfff;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

.hud {
    position: absolute;
    left: 18px;
    top: 16px;
    z-index: 5;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.hud-item, .small-btn {
    background: rgba(16, 30, 42, 0.78);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 18px;
    backdrop-filter: blur(4px);
}

.small-btn {
    color: #fff;
    cursor: pointer;
}

.overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(12, 18, 26, 0.48);
    z-index: 10;
    border-radius: 18px;
}

    .overlay.show {
        display: flex;
    }

.card {
    width: min(88%, 460px);
    padding: 28px 24px;
    text-align: center;
    border-radius: 22px;
    background: rgba(13, 24, 35, 0.88);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

    .card h1, .card h2 {
        margin: 0 0 16px;
    }

    .card p {
        margin: 8px 0;
        color: #d7e6f0;
    }

.primary-btn {
    margin-top: 14px;
    border: none;
    background: linear-gradient(180deg, #4aa7ff, #2378f0);
    color: #fff;
    border-radius: 999px;
    padding: 12px 24px;
    font-size: 18px;
    cursor: pointer;
}
/* 游戏下方大按钮区域 */
.game-controls {
    width: 100%;
    display: flex;
    gap: 18px;
    margin-top: 12px;
}


/* 两个按钮公共样式 */
.control-btn {
    flex: 1;
    /* 做得像参考图一样大 */
    height: 96px;
    border: 3px solid #26313a;
    border-radius: 18px;
    color: #ffffff;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
}


/* 左：跳跃，深蓝色 */
.jump-btn {
    background: linear-gradient( 180deg, #245b91 0%, #163f6b 100% );
    box-shadow: 0 6px 0 #0b2948, 0 8px 14px rgba(0, 0, 0, 0.22);
}


/* 右：趴下，灰色 */
.slide-btn {
    background: linear-gradient( 180deg, #697078 0%, #4c5258 100% );
    box-shadow: 0 6px 0 #30353a, 0 8px 14px rgba(0, 0, 0, 0.22);
}


/* 鼠标 / 手机按下效果 */
.control-btn:active,
.control-btn.is-pressed {
    transform: translateY(5px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 3px 6px rgba(0, 0, 0, 0.2);
    filter: brightness(0.82);
}


/* 鼠标悬停 */
.control-btn:hover {
    filter: brightness(1.06);
}


/* 手机端 */
@media (max-width: 700px) {

    .game-controls {
        gap: 10px;
        margin-top: 8px;
    }

    .control-btn {
        height: 76px;
        font-size: 25px;
        border-radius: 14px;
        border-width: 2px;
    }
}

@media (min-width: 900px) {
    .mobile-controls {
        display: none;
    }
}

@media (max-width: 600px) {
    .hud-item, .small-btn {
        font-size: 15px;
        padding: 8px 12px;
    }

    .ctrl-btn {
        width: 64px;
        height: 64px;
    }
}

/* ===== 手机版布局优化 ===== */
@media (max-width: 700px) {

    /* 整个页面尽量利用手机宽度 */
    .page {
        width: 100%;
        min-height: 100vh;
        padding: 6px;
        align-items: flex-start;
        justify-content: center;
    }


    /* 游戏主体放大 */
    .game-shell {
        width: calc(100vw - 12px);
        max-width: none;
    }


    /* 游戏画面尽量铺满 */
    #gameCanvas {
        width: 100%;
        height: auto;
        border-radius: 14px;
    }


    /* 顶部分数区域缩小一点 */
    .hud {
        left: 8px;
        top: 8px;
        gap: 6px;
    }

    .hud-item,
    .small-btn {
        font-size: 13px;
        padding: 6px 10px;
        border-radius: 18px;
    }


    /* 两个操作按钮 */
    .game-controls {
        width: 100%;
        display: flex;
        gap: 8px;
        margin-top: 8px;
    }


    /* 手机版按钮不要那么高 */
    .control-btn {
        flex: 1;
        height: 58px;
        font-size: 22px;
        font-weight: 700;
        border-width: 2px;
        border-radius: 12px;
        letter-spacing: 1px;
    }


        /* 按下仍然有反馈 */
        .control-btn:active,
        .control-btn.is-pressed {
            transform: translateY(3px);
            filter: brightness(0.86);
        }
}
/* =========================================
   整体页面：电脑 + 手机统一乳白色背景
   ========================================= */

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    background: #f6f1e8;
}

body {
    min-height: 100vh;
}


/* 整个游戏区域水平居中 */
.page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 18px 12px 30px;
    background: #f6f1e8;
}


/* 游戏主体 */
.game-shell {
    position: relative;
    width: min(96vw, 1280px);
    margin: 0 auto;
}


/* 游戏画面 */
#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 18px;
}


/* =========================================
   开始 / 游戏结束页面居中
   ========================================= */

.overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(15, 25, 35, 0.48);
    z-index: 10;
}

    .overlay.show {
        display: flex;
    }


/* 开始界面的卡片 */
.card {
    width: min(78%, 520px);
    margin: auto;
    padding: 28px 28px 30px;
    text-align: center;
    border-radius: 22px;
    background: rgba(17, 31, 44, 0.94);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}


/* 开始游戏按钮 */
.primary-btn {
    display: block;
    min-width: 220px;
    margin: 22px auto 0;
    padding: 14px 32px;
    border: none;
    border-radius: 999px;
    font-size: 20px;
    cursor: pointer;
}


/* =========================================
   跳跃 / 趴下 两个大按钮
   ========================================= */

.game-controls {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 12px auto 0;
}


.control-btn {
    /* 两个按钮几乎铺满整行 */
    flex: 1 1 0;
    height: 82px;
    padding: 0 20px;
    border: 3px solid #27323a;
    border-radius: 16px;
    color: #ffffff;
    font-size: 30px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.07s ease, box-shadow 0.07s ease, filter 0.07s ease;
}


/* 跳跃：深蓝色 */
.jump-btn {
    background: linear-gradient( 180deg, #2e639b 0%, #174672 100% );
    box-shadow: 0 6px 0 #0c2d4e, 0 8px 12px rgba(0, 0, 0, 0.18);
}


/* 趴下：灰色 */
.slide-btn {
    background: linear-gradient( 180deg, #858a90 0%, #5b6066 100% );
    box-shadow: 0 6px 0 #3b3f44, 0 8px 12px rgba(0, 0, 0, 0.18);
}


/* 按下反馈 */
.control-btn:active,
.control-btn.is-pressed {
    transform: translateY(5px);
    filter: brightness(0.86);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 3px 5px rgba(0, 0, 0, 0.16);
}

/* =========================================
   手机端
   ========================================= */
@media (max-width: 700px) {
    html, body, .page {
        background: #f6f1e8;
    }

    .page {
        width: 100%;
        padding: 8px 6px 24px;
        justify-content: center;
        align-items: flex-start;
    }


    /* 手机上的游戏尽量占满屏幕宽度 */
    .game-shell {
        width: calc(100vw - 12px);
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }


    #gameCanvas {
        width: 100%;
        border-radius: 14px;
    }


    /* 手机上的按钮横向更宽，但不要再那么高 */
    .game-controls {
        width: 100%;
        gap: 8px;
        margin: 8px auto 0;
    }


    .control-btn {
        flex: 1;
        height: 62px;
        padding: 0 8px;
        border-radius: 12px;
        border-width: 2px;
        font-size: 23px;
        letter-spacing: 1px;
    }


    /* 手机版开始页缩小，严格居中 */
    .card {
        width: 82%;
        max-width: 420px;
        margin: auto;
        padding: 22px 16px 24px;
    }


        .card h1 {
            margin-top: 0;
            font-size: 30px;
            line-height: 1.2;
        }


        .card p {
            font-size: 16px;
            line-height: 1.4;
            margin: 7px 0;
        }


    .primary-btn {
        min-width: 190px;
        padding: 12px 26px;
        font-size: 18px;
    }
}


/* 更窄的手机 */
@media (max-width: 430px) {

    .control-btn {
        height: 58px;
        font-size: 21px;
    }


    .game-controls {
        gap: 6px;
    }


    .card {
        width: 86%;
        padding: 18px 14px 20px;
    }


        .card h1 {
            font-size: 27px;
        }


        .card p {
            font-size: 14px;
        }
}

/* ================================
   最终覆盖：手机 + 电脑
   一定放在 styles.css 最后
   ================================ */

html,
body,
.page {
    background: #f6f1e8 !important;
}

/* 整个游戏居中 */
.page {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding: 12px !important;
}

.game-shell {
    width: min(98vw, 1280px) !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
}

/* ================================
   下方两个按钮
   同时兼容旧类名和新类名
   ================================ */

.mobile-controls,
.game-controls {
    position: static !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    margin: 10px auto 0 !important;
    right: auto !important;
    bottom: auto !important;
}

/* 按钮加宽 */
.ctrl-btn,
.control-btn {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: none !important;
    height: 76px !important;
    border-radius: 14px !important;
    border: 3px solid #27323a !important;
    color: white !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    touch-action: none !important;
    transition: transform 0.07s ease, filter 0.07s ease, box-shadow 0.07s ease !important;
}

/* 跳跃按钮：深蓝 */
#jumpBtn {
    background: linear-gradient( 180deg, #326ba5 0%, #174774 100% ) !important;
    box-shadow: 0 5px 0 #0d2e50, 0 7px 12px rgba(0,0,0,0.20) !important;
}

/* 趴下按钮：灰色 */
#slideBtn {
    background: linear-gradient( 180deg, #888d93 0%, #5c6167 100% ) !important;
    box-shadow: 0 5px 0 #3b4045, 0 7px 12px rgba(0,0,0,0.20) !important;
}

/* 按下效果 */
.ctrl-btn:active,
.control-btn:active,
.ctrl-btn.is-pressed,
.control-btn.is-pressed {
    transform: translateY(4px) !important;
    filter: brightness(0.84) !important;
    box-shadow: 0 1px 0 rgba(0,0,0,0.5), 0 2px 5px rgba(0,0,0,0.18) !important;
}


/* ================================
   开始 / 结束页面居中
   ================================ */

.overlay.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.overlay .card {
    width: min(82%, 520px) !important;
    max-width: 520px !important;
    margin: auto !important;
    padding: 26px 24px !important;
    text-align: center !important;
    border-radius: 20px !important;
}

/* 开始按钮也居中 */
.primary-btn {
    display: block !important;
    width: min(70%, 280px) !important;
    margin: 20px auto 0 !important;
    padding: 13px 20px !important;
    font-size: 20px !important;
}


/* ================================
   手机
   ================================ */

@media (max-width: 700px) {

    .page {
        padding: 4px !important;
    }

    .game-shell {
        width: calc(100vw - 8px) !important;
        max-width: none !important;
    }

    #gameCanvas {
        width: 100% !important;
        height: auto !important;
        border-radius: 14px !important;
    }

    /* 两个按钮横向尽量铺满 */
    .mobile-controls,
    .game-controls {
        width: 100% !important;
        gap: 6px !important;
        margin-top: 7px !important;
    }

    /* 手机按钮：更宽、更矮 */
    .ctrl-btn,
    .control-btn {
        flex: 1 1 50% !important;
        height: 58px !important;
        font-size: 22px !important;
        border-radius: 11px !important;
        border-width: 2px !important;
    }

    /* 开始页面 */
    .overlay .card {
        width: 86% !important;
        max-width: 420px !important;
        padding: 18px 14px 20px !important;
        margin: auto !important;
    }

        .overlay .card h1 {
            font-size: 27px !important;
            line-height: 1.2 !important;
            margin: 0 0 14px !important;
        }

        .overlay .card p {
            font-size: 14px !important;
            line-height: 1.35 !important;
            margin: 6px 0 !important;
        }

    .primary-btn {
        width: 65% !important;
        font-size: 18px !important;
        margin: 16px auto 0 !important;
    }
}
