* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #fff;
    overflow: hidden;
    /* 移动端：禁止长按选中/双击缩放/滚动回弹，保证点击即跳跃 */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    overscroll-behavior: none;
}

.gameContainer {
    background-image: url(cover.jpg);
    background-repeat: no-repeat;
    background-size: cover;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* 移动端动态视口高度 */
}

.hero {
    background-image: url(hero.png);
    background-repeat: no-repeat;
    background-size: cover;
    width: 255px;
    height: 240px;
    position: absolute;
    bottom: 50px;
    left: 100px;
    z-index: 1;
}

.obstacle {
    width: 255px;
    height: 240px;
    background-image: url(obstacle_1.png);
    background-size: cover;
    position: absolute;
    bottom: 50px;
    left: 100vw;
    z-index: 1;
}

.obstacle2 {
    width: 255px;
    height: 240px;
    background-image: url(obstacle_2.png); 
    background-size: cover;
    position: absolute;
    bottom: 50px;
    left: 140vw;
    z-index: 1;
}

.animateHero {
    animation: hero 0.9s linear;
}

.obstacleMove {
    animation: obstacleMove 4s linear infinite;
}

.obstacleMove2 {
    animation: obstacleMove 8s linear infinite;
}
.gameOver{
    font-size: 80px;
    font-family: "Arial Black", sans-serif;
    color: #fff;
    text-align: center;
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: gameOverText 1s ease-in-out forwards;
    ;
}

.gameOver.active {
    visibility: visible;
}

@keyframes gameOverText {
    0% {
        opacity: 0;
        text-shadow: none;
    }
    50% {
        opacity: 0.8;
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 25px rgba(255, 255, 255, 1);
    }
}





.replay{
    font-size: 25px;
    color: #cfcfcf;
    font-weight: bold;
    position: absolute;
    left: 50%;
    top: 30%;
    transform: translate(-50%, -50%);
    font-family: sans-serif;
    z-index: 1;
    visibility: hidden;
    }
.creator {
    font-size: 15px;
    color: #cfcfcf;
    font-weight: bold;
    position: absolute;
    right: 47px;
    top: 7px;
    font-family: sans-serif;
    z-index: 1
}









#scoreCont {
    font-size: 25px;
    color: #fff;
    font-weight: bold;
    position: absolute;
    right: 45px;
    top: 97px;
    border: 5px solid #fff;
    padding: 10px;
    font-family: sans-serif;
    z-index: 1;
    border-radius: 10px;
}

@keyframes hero {
    0% {
        bottom: 60px;
    }
    50% {
        bottom: 400px;
    }
    100% {
        bottom: 50px;
    }
}

@keyframes obstacleMove {
    0% {
        left: 100vw;
    }
    100% {
        left: -200px;
    }
}

.restart {
    position: absolute;
    top: 31px;
    right: 47px;
    font-size: 16px;
    padding: 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 1;
  }

/* 上传照片作为角色 */
.faceUpload {
    position: absolute;
    top: 31px;
    left: 47px;
    z-index: 2;
    font-family: sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.faceUpload input[type="file"] {
    display: none;
}

.faceUpload label,
.faceUpload button {
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background-color: #2196F3;
    color: #fff;
    user-select: none;
}

.faceUpload button {
    background-color: rgba(255, 255, 255, 0.75);
    color: #333;
}

.faceUpload label:hover {
    background-color: #1976D2;
}

/* 移动端点击跳跃提示：仅触摸设备显示，桌面隐藏 */
.tapHint {
    display: none;
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    font-family: sans-serif;
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    padding: 10px 22px;
    border-radius: 24px;
    pointer-events: none; /* 不拦截点击，点击穿透到 document 触发跳跃 */
    animation: tapPulse 1.6s ease-in-out infinite;
}

@keyframes tapPulse {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}

/* 触摸设备（手机/平板）显示提示，并放大重开按钮便于点击 */
@media (hover: none) and (pointer: coarse) {
    .tapHint { display: block; }
    .restart { font-size: 18px; padding: 12px 16px; top: 12px; }
    .faceUpload { top: 12px; }
    .hero { width: 200px; height: 190px; }
    .obstacle, .obstacle2 { width: 200px; height: 190px; }
}

/* 窄屏手机：缩小角色避免遮挡 */
@media (max-width: 420px) {
    .hero { width: 170px; height: 160px; }
    .obstacle, .obstacle2 { width: 170px; height: 160px; }
    #scoreCont { font-size: 18px; right: 12px; top: 70px; padding: 6px; }
    .tapHint { font-size: 13px; padding: 8px 16px; }
}