body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #002233;
    position: fixed;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    font-family: 'Arial', sans-serif;
    pointer-events: none; 
    user-select: none;
    z-index: 10;
}

.score-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
}

.bgm-toggle-btn {
    pointer-events: auto; 
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}

.bgm-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* スタート画面・ゲームオーバー・クリア画面共通レイアウト */
#start-screen, #gameover-screen, #gameclear-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 34, 51, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    padding: 30px 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 85%;
    box-shadow: 0 0 25px rgba(0,0,0,0.6);
    position: relative;
    font-family: sans-serif;
}

/* 特殊モードのカラー調整 */
.dark-modal { background: #112233; color: #fff; border: 2px solid #ff4444; }
.gold-modal { background: #fffdf0; color: #333; border: 3px solid #ffd700; }

.modal h1 { color: #00BFFF; margin-top: 0; margin-bottom: 10px; font-size: 28px; }
.danger-text { color: #ff4444 !important; text-shadow: 0 0 10px rgba(255,68,68,0.3); }
.gold-text { color: #d4af37 !important; font-size: 32px !important; }

.modal h2 { color: #666; font-size: 16px; margin-bottom: 15px; }
.modal p { font-size: 16px; line-height: 1.5; color: inherit; margin-bottom: 25px; }

.button-group, .button-group-single {
    display: flex;
    justify-content: center;
    gap: 20px;
}

button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    transition: 0.2s;
}
button:active { transform: scale(0.95); }

#bgm-on-btn { background-color: #00BFFF; color: white; }
#bgm-off-btn { background-color: #ccc; color: #333; }
.next-btn, #to-bgm-btn, .success-btn { background-color: #32CD32; color: white; }
.neutral-btn { background-color: #778899; color: white; }

#skip-btn {
    position: absolute;
    bottom: -55px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    color: #fff;
    border: 1px solid #fff;
    font-size: 13px;
    padding: 6px 15px;
    border-radius: 20px;
}

/* カウントダウン */
#countdown-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    pointer-events: none;
}
#countdown-text {
    font-size: 100px;
    font-weight: bold;
    color: #fff;
    font-family: sans-serif;
    text-shadow: 0 0 20px rgba(0,0,0,0.8);
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0% { transform: scale(1.2); opacity: 0; }
    10% { opacity: 1; }
    90% { transform: scale(1.0); opacity: 1; }
    100% { opacity: 0; }
}

/* ヌンチャクコントローラー */
#joystick-container {
    position: absolute;
    bottom: 40px;
    right: 40px;
    width: 120px;
    height: 120px;
    z-index: 100;
    display: none;
}
#joystick-base {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    position: relative;
}
#joystick-stick {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}