body {
    font-family: 'Shippori Mincho', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

#gameCanvas {
    font-family: 'Shippori Mincho', sans-serif;
    display: block;
}

#gameOverScreen {
    font-size: 40px;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    text-align: center;
    flex-direction: column;
}

#gameOverScreen p {
    margin: 0 0 20px 0;
}

#shareScreen {
    font-size: 40px;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1001;
    text-align: center;
    flex-direction: column;
}

button {
    font-family: 'Shippori Mincho', sans-serif;
    margin: 10px;
    padding: 10px 20px;
    font-size: 20px;
}

.bubbly-button {
font-family: 'Shippori Mincho', sans-serif;
display: inline-block;
font-size: 20px;
padding: 0.5em 1em;
margin-top: 5px;
margin-bottom: 60px;
-webkit-appearance: none;
appearance: none;
background-color: #ff0081;
color: #fff;
border-radius: 4px;
border: none;
cursor: pointer;
position: relative;
transition: transform ease-in 0.1s, box-shadow ease-in 0.25s;
box-shadow: 0 2px 25px rgba(255, 0, 130, 0.5);
}

.bubbly-button:focus {
outline: 0;
}

.bubbly-button:before, .bubbly-button:after {
position: absolute;
content: '';
display: block;
width: 140%;
height: 100%;
left: -20%;
z-index: -1000;
transition: all ease-in-out 0.5s;
background-repeat: no-repeat;
}

.bubbly-button:before {
display: none;
top: -75%;
background-image: 
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, transparent 20%, #ff0081 20%, transparent 30%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, transparent 10%, #ff0081 15%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%);
background-size: 10% 10%, 20% 20%, 15% 15%, 20% 20%, 18% 18%, 10% 10%, 15% 15%, 10% 10%, 18% 18%;
}

.bubbly-button:after {
display: none;
bottom: -75%;
background-image: 
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, transparent 10%, #ff0081 15%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%),
    radial-gradient(circle, #ff0081 20%, transparent 20%);
background-size: 15% 15%, 20% 20%, 18% 18%, 20% 20%, 15% 15%, 10% 10%, 20% 20%;
}

.bubbly-button:active {
transform: scale(0.9);
background-color: darken(#ff0081, 5%);
box-shadow: 0 2px 25px rgba(255, 0, 130, 0.2);
}

.bubbly-button.animate:before {
display: block;
animation: topBubbles ease-in-out 0.75s forwards;
}

.bubbly-button.animate:after {
display: block;
animation: bottomBubbles ease-in-out 0.75s forwards;
}

@keyframes topBubbles {
0% {
    background-position: 5% 90%, 10% 90%, 10% 90%, 15% 90%, 25% 90%, 25% 90%, 40% 90%, 55% 90%, 70% 90%;
}
50% {
    background-position: 0% 80%, 0% 20%, 10% 40%, 20% 0%, 30% 30%, 22% 50%, 50% 50%, 65% 20%, 90% 30%;
}
100% {
    background-position: 0% 70%, 0% 10%, 10% 30%, 20% -10%, 30% 20%, 22% 40%, 50% 40%, 65% 10%, 90% 20%;
    background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
}
}

@keyframes bottomBubbles {
0% {
    background-position: 10% -10%, 30% 10%, 55% -10%, 70% -10%, 85% -10%, 70% -10%, 70% 0%;
}
50% {
    background-position: 0% 80%, 20% 80%, 45% 60%, 60% 100%, 75% 70%, 95% 60%, 105% 0%;
}
100% {
    background-position: 0% 90%, 20% 90%, 45% 70%, 60% 110%, 75% 80%, 95% 70%, 110% 10%;
    background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
}
}

.score-box {
    border: 2px solid red;
    /* 紅色邊框用於顯示得分判定區域 */
    position: absolute;
    pointer-events: none;
    /* 確保不影響點擊事件 */
}

#startGameButton {
    margin: 20px;
}

#BGM {
    position: absolute;
    top: 10px;
    right: 100px;
    width: 130px;
    height: 50px;
    font-size: 15px;
    background-color: #5100ff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

#BGM:hover {
    background-color: #2f0086;
    transform: scale(1.1);
}

#nicknamePopup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border: 2px solid #ccc;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

#nicknamePopup input {
    width: 80%;
    padding: 5px;
    margin: 10px 0;
}

#nicknamePopup button {
    padding: 5px 10px;
}

/* 輸入框基本樣式 */
#nicknameInput {
    width: 300px;
    padding: 10px;
    font-size: 16px;
    border: 2px solid #ccc;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
}

/* 當輸入框聚焦時 */
#nicknameInput:focus {
    border-color: #5c9bf7;
    box-shadow: 0 0 10px rgba(92, 159, 247, 0.5);
}

/* 輸入框的提示文字樣式 */
#nicknameInput::placeholder {
    color: #888;
    font-style: italic;
}

/* 增加 hover 效果 */
#nicknameInput:hover {
    border-color: #888;
}

/* 半透明的排行榜樣式 */
#leaderboardScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: none;
    padding: 20px;
     z-index: 2000;
    box-sizing: border-box;
    overflow-y: scroll;
}

#leaderboardScreen h2 {
    text-align: center;
}

#leaderboardScreen ul {
    list-style-type: none;
    padding: 0;
}

#leaderboardScreen li {
    padding: 10px 0;
    border-bottom: 1px solid #ccc;
}

.closeLeaderboard {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4747;
    color: white;
    border: none;
    padding: 12px 18px; /* 增加內邊距，使按鈕更大 */
    cursor: pointer;
    font-size: 16px; /* 增加字體大小 */
    border-radius: 8px; /* 圓角效果 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 添加陰影 */
    transition: background 0.3s ease, transform 0.3s ease; /* 添加過渡效果 */
}

.closeLeaderboard:hover {
    background: #ff3030; /* 懸停時變色 */
    transform: scale(1.1); /* 懸停時略微放大按鈕 */
}

.closeLeaderboard:active {
    background: #e02424; /* 點擊時變色 */
    transform: scale(1); /* 按下時恢復原狀 */
}


footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px;
}

#returnButton {
    font-size: 18px;
    padding: 10px 20px;
    background-color: #ffcc00;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: #000;
    font-weight: bold;
}

#returnButton:hover {
    background-color: #ffaa00;
}

#copyright {
    font-size: 14px;
    color: #ddd;
    margin: 5px 0 0;
}