body {
            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #87CEEB 100%);
            font-family: 'Arial', sans-serif;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            overflow: hidden;
        }

        .game-container {
            text-align: center;
            background: linear-gradient(145deg, #ffffff, #f0f0f0);
            padding: 20px;
            border-radius: 15px;
            box-shadow: 0 12px 35px rgba(0,0,0,0.3);
            border: 3px solid #333;
            position: relative;
            margin-bottom: 10px;
        }

        #gameCanvas {
            display: block;
            background: transparent;
            border-radius: 8px;
        }

        .screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: rgba(0, 0, 0, 0.85);
            color: white;
            z-index: 10;
            border-radius: 8px;
        }

        .screen.hidden {
            display: none;
        }

        button {
            padding: 15px 30px;
            font-size: 20px;
            font-weight: bold;
            color: white;
            background: linear-gradient(45deg, #FF6B6B, #FF8E8E);
            border: none;
            border-radius: 12px;
            cursor: pointer;
            margin: 10px;
            transition: all 0.3s ease;
            box-shadow: 0 6px 15px rgba(0,0,0,0.2);
        }

        button:hover {
            background: linear-gradient(45deg, #FF8E8E, #FFB1B1);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0,0,0,0.3);
        }

        .start-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(30, 30, 80, 0.9));
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: white;
            border-radius: 8px;
            z-index: 10;
        }

        .start-screen h1 {
            font-size: 40px;
            margin: 20px 0;
            background: linear-gradient(45deg, #f5f5f3, #f5f4f3);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .start-button {
            background: linear-gradient(145deg, #4CAF50, #45a049);
            color: white;
            padding: 20px 40px;
            font-size: 22px;
            font-weight: bold;
            border: none;
            border-radius: 15px;
            cursor: pointer;
            margin-top: 25px;
            transition: all 0.3s ease;
        }

        .game-over-screen, .game-complete-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(145deg, rgb(71, 50, 50), rgb(48, 21, 14));
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            border-radius: 8px;
            z-index: 20;
        }

        .game-complete-screen {
            background: linear-gradient(145deg, rgba(0, 150, 0, 1), rgba(0, 200, 0, 1));
        }

        .game-over-image {
            width: 70px;
            height: 70px;
            margin-bottom: 0px;
            border-radius: 50px;
        }

        .game-complete-images {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: min(15px, 3vw);     /* 画面幅に応じて間隔調整 */
            margin-bottom: 20px;
            margin-top: 20px;
            padding: 0 10px;         /* 左右に少し余白 */
            flex-wrap: wrap;         /* 必要に応じて折り返し */
        }

        .game-over-screen h2, .game-complete-screen h2 {
            font-size: 36px;
            margin-bottom: 20px;
            color: white;
            text-shadow: 3px 3px 6px rgba(244, 240, 240, 1);
        }

         .game-over-screen p, .game-complete-screen p {
            font-size: 24px;
            margin: 10px 0;
            color: white;
        }

        .hidden {
            display: none !important;
        }

        .controls {
            margin-top: 15px;
            color: #333;
            background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(240,240,240,0.9));
            padding: 15px;
            border-radius: 12px;
            border: 2px solid #ddd;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        }

        .controls p {
            margin: 8px 0;
            font-size: 16px;
            font-weight: bold;
        }

        /* モバイルコントローラーのスタイル */
        .mobile-controls {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            width: 100%;
            max-width: 800px;
            padding: 20px;
            box-sizing: border-box;
            position: relative;
            z-index: 5;
        }

        .d-pad {
            position: relative;
            width: 120px;
            height: 120px;
        }

        .d-pad-button {
            position: absolute;
            width: 40px;
            height: 40px;
            background: linear-gradient(145deg, #4a5568, #2d3748);
            border: 2px solid #1a202c;
            border-radius: 8px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 18px;
            font-weight: bold;
            color: white;
            text-shadow: 1px 1px 2px rgba(245, 237, 237, 0.8);
            cursor: pointer;
            user-select: none;
            touch-action: manipulation;
            transition: all 0.1s ease;
        }

        .d-pad-button:active {
            background: linear-gradient(145deg, #2d3748, #1a202c);
            transform: scale(0.95);
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
        }

        .d-pad-up {
            top: 0;
            left: 40px;
        }

        .d-pad-down {
            bottom: 0;
            left: 40px;
        }

        .d-pad-left {
            top: 40px;
            left: 0;
        }

        .d-pad-right {
            top: 40px;
            right: 0;
        }

        .d-pad-center {
            top: 40px;
            left: 40px;
            background: linear-gradient(145deg, #2d3748, #1a202c);
            cursor: default;
        }

        .action-buttons {
            display: flex;
            flex-direction: column;
            gap: 15px;
            align-items: center;
        }

        .jump-button {
            width: 80px;
            height: 80px;
            background: linear-gradient(145deg, #e53e3e, #c53030);
            border: 3px solid #9b2c2c;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 16px;
            font-weight: bold;
            color: white;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
            cursor: pointer;
            user-select: none;
            touch-action: manipulation;
            transition: all 0.1s ease;
        }

        .jump-button:active {
            background: linear-gradient(145deg, #c53030, #9b2c2c);
            transform: scale(0.95);
            box-shadow: inset 0 3px 6px rgba(0,0,0,0.3);
        }

        .pause-button {
            width: 60px;
            height: 40px;
            background: linear-gradient(145deg, #805ad5, #6b46c1);
            border: 2px solid #553c9a;
            border-radius: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 12px;
            font-weight: bold;
            color: white;
            cursor: pointer;
            user-select: none;
            touch-action: manipulation;
            transition: all 0.1s ease;
        }

        .pause-button:active {
            background: linear-gradient(145deg, #6b46c1, #553c9a);
            transform: scale(0.95);
        }

        /* レスポンシブデザイン */
        @media (max-width: 900px) {
            body {
                padding: 5px;
            }

            .game-container {
                padding: 10px;
                margin-bottom: 5px;
            }

            #gameCanvas {
                max-width: 100%;
                height: auto;
            }

            .controls {
                display: none; /* モバイルでは従来のコントロール説明を非表示 */
            }

            .mobile-controls {
                padding: 10px;
            }

            .d-pad {
                width: 100px;
                height: 100px;
            }

            .d-pad-button {
                width: 35px;
                height: 35px;
                font-size: 16px;
            }

            .d-pad-up, .d-pad-down {
                left: 32.5px;
            }

            .d-pad-left, .d-pad-right, .d-pad-center {
                top: 32.5px;
            }

            .jump-button {
                width: 70px;
                height: 70px;
                font-size: 14px;
            }

            .pause-button {
                width: 50px;
                height: 35px;
                font-size: 10px;
            }

            .start-screen h1 {
                font-size: 28px;
            }
        }

        @media (max-width: 600px) {
            #gameCanvas {
                width: 100%;
                max-width: 100vw;
            }
        }

        /* デスクトップでは mobile-controls を非表示 */
        @media (min-width: 901px) {
            .mobile-controls {
                display: none;
            }
        }

        /* より小さい画面での調整 */
        @media (max-width: 600px) {
        .game-complete-image {
            width: min(100px, 28vw);  /* より小さい画面では比率を上げる */
            height: min(100px, 28vw);
            border-radius: 12px;
            margin: 0 3px;
        }
        
        /* ゲーム完了画面の画像をレスポンシブ対応 */
        .game-complete-image {
            width: min(120px, 25vw);  /* 画面幅の25%、最大120px */
            height: min(120px, 25vw);
            border-radius: 15px;
            margin: 0 5px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
            object-fit: cover;  /* 画像のアスペクト比を保持 */
        }

        .game-complete-images {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: min(15px, 3vw);     /* 画面幅に応じて間隔調整 */
            margin-bottom: 20px;
            margin-top: 20px;
            padding: 0 10px;         /* 左右に少し余白 */
            flex-wrap: wrap;         /* 必要に応じて折り返し */
        }

        /* 非常に小さい画面での調整 */
        @media (max-width: 400px) {
            .game-complete-image {
                width: min(80px, 30vw);
                height: min(80px, 30vw);
                border-radius: 10px;
            }
    
            .game-complete-images {
                gap: min(8px, 1.5vw);
                }
            }   
    
            /* 横向きの小さい画面での調整 */
            @media (max-width: 800px) and (max-height: 500px) {
                .game-complete-image {
                    width: min(70px, 20vw);
                    height: min(70px, 20vw);
                }
        
                .game-complete-images {
                    gap: min(8px, 2vw);
                    margin-top: 10px;
                    margin-bottom: 10px;
                }
            }
        }
/* 死亡画面のスタイルを追加 */
    #deathScreen {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.9);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
        animation: fadeIn 0.5s ease-in;
    }

    .death-content {
        text-align: center;
        color: white;
        background: rgba(139, 0, 0, 0.8);
        padding: 40px;
        border-radius: 20px;
        border: 3px solid #ff4444;
        box-shadow: 0 0 30px rgba(255, 68, 68, 0.5);
        animation: slideIn 0.5s ease-out;
    }

    .death-image {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
        /*filter: grayscale(100%) brightness(0.7);*/
        animation: shake 0.5s ease-in-out;
    }

    .death-title {
        font-size: 36px;
        font-weight: bold;
        color: #ff4444;
        margin: 10px 0;
        text-shadow: 2px 2px 4px rgba(247, 238, 238, 1);
        animation: pulse 1s infinite;
    }

    .death-lives {
        font-size: 20px;
        margin: 20px 0;
        color: #ffaaaa;
    }

    .death-buttons {
        display: flex;
        gap: 20px;
        justify-content: center;
        margin-top: 30px;
    }

    .continue-button, .give-up-button {
        padding: 12px 24px;
        font-size: 18px;
        font-weight: bold;
        border: none;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        text-transform: uppercase;
    }

    .continue-button {
        background: #4CAF50;
        color: white;
        box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
    }

    .continue-button:hover {
        background: #45a049;
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
    }

    .give-up-button {
        background: #f44336;
        color: white;
        box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
    }

    .give-up-button:hover {
        background: #da190b;
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(244, 67, 54, 0.4);
    }

    .hidden {
        display: none !important;
    }

    #volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    }

    #volumeIcon {
    font-size: 20px;
    cursor: pointer;
    }

    /* アニメーション */
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes slideIn {
        from { 
            transform: translateY(-50px) scale(0.8);
            opacity: 0;
        }
        to { 
            transform: translateY(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes shake {
        0%, 100% { transform: translateX(0); }
        25% { transform: translateX(-5px); }
        75% { transform: translateX(5px); }
    }

    @keyframes pulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.05); }
    }