* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: none;
    /* 防止默认触摸行为 */
}

body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #6e45e2 0%, #88d3ce 100%);
    /* 宝石主题渐变背景 */
    margin: 0;
    padding: 10px;
    /* 添加内边距防止内容贴边 */
    box-sizing: border-box;
    color: #fff;
    /* 默认文字颜色 */
    overflow: hidden;
    /* 防止页面滚动 */
}

.game-container {
    background: rgba(0, 0, 0, 0.6);
    /* 半透明深色背景，突出内容 */
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 100%;
    max-width: 500px;
    /* 限制最大宽度 */
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    color: #f0e68c;
    /* 卡其色/金色标题 */
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    gap: 20px;
}

.game-header span {
    margin: 0;
    font-weight: bold;
    white-space: nowrap;
}

#score,
#level,
#target-score {
    color: #f0e68c;
    margin: 0 5px;
}

.game-area {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#gameCanvas {
    border: 3px solid #f0e68c;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(240, 230, 140, 0.5);
    display: block;
}

.next-gem-area {
    position: absolute;
    top: 0;
    right: -80px;
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 70px;
}

.next-gem-area h3 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 1em;
    white-space: nowrap;
}

#nextGemCanvas {
    border: 2px dashed #aaa;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    width: 60px;
    height: 30px;
    display: block;
    margin: 0 auto;
}

.controls {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    /* 垂直排列 */
    align-items: center;
    gap: 15px;
}

button {
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(45deg, #8a2be2, #ff69b4);
    /* 紫色到粉色渐变 */
    border: none;
    border-radius: 25px;
    /* 圆角 */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

button:hover {
    background: linear-gradient(45deg, #ff69b4, #8a2be2);
    /* 悬停时反转渐变 */
    transform: translateY(-2px);
    /* 轻微上移 */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.instructions {
    margin-top: 10px;
    color: #eee;
    /* 浅灰色文字 */
    font-size: 0.9em;
}

.instructions p {
    margin: 5px 0;
}

@media (max-width: 768px) {
    .game-container {
        padding: 20px;
    }
    h1 {
        font-size: 2em;
    }
    .game-header {
        flex-direction: column;
        /* 垂直排列头部信息 */
        gap: 10px;
        font-size: 1em;
    }
    .game-area {
        margin: 0 auto;
        width: fit-content;
    }
    .next-gem-area {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 60px;
        padding: 5px;
    }
    #nextGemCanvas {
        width: 50px;
        height: 25px;
    }
    button {
        padding: 10px 20px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .game-container {
        padding: 10px;
    }
    h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    .game-header {
        padding: 5px;
        margin-bottom: 10px;
    }
    .game-header span {
        margin: 0 5px;
        font-size: 0.9em;
    }
    .game-area {
        margin: 0 auto;
        width: fit-content;
    }
    #gameCanvas {
        width: 300px;
        height: 300px;
    }
    .next-gem-area {
        position: absolute;
        top: 5px;
        right: 5px;
        width: 50px;
        padding: 4px;
    }
    #nextGemCanvas {
        width: 44px;
        height: 22px;
    }
    .controls {
        margin-top: 15px;
        gap: 10px;
    }
    button {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}