body {
    margin: 0;
    padding: 0;
    background-color: #222;
    color: #fff;
    font-family: 'DotGothic16', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    text-align: center;
}

h1 {
    font-size: 24px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px #000;
}

canvas {
    background-color: #87CEEB; /* 空の色 */
    border: 4px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    image-rendering: pixelated;
}

#ui-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

#message {
    font-size: 32px;
    text-shadow: 2px 2px 0px #000;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
}

#btn-container {
    margin-top: 20px;
    pointer-events: auto;
}

button {
    font-family: 'DotGothic16', sans-serif;
    font-size: 16px;
    padding: 10px 20px;
    margin: 0 10px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: 2px solid #fff;
    outline: none;
}

button:hover {
    background-color: #45a049;
}

#share-btn {
    background-color: #1DA1F2;
}

#share-btn:hover {
    background-color: #0c85d0;
}

/* モバイル向けコントロール（デフォルトは非表示） */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    width: 100%;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    pointer-events: none; /* コンテナ自体はクリックを透過 */
    z-index: 100;
}

#dpad, #action-pad {
    display: flex;
    pointer-events: auto; /* ボタン部分はクリック可能に */
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: #fff;
    font-size: 24px;
    margin: 5px;
    pointer-events: auto; /* ボタン部分はクリック可能に */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.6);
}

.action-btn {
    width: 70px;
    height: 70px;
    font-size: 16px;
    border-radius: 10px;
    flex-direction: column;
}

/* スマホ用のレスポンシブ対応 */
@media (max-width: 800px) {
    #mobile-controls {
        display: flex;
    }
    
    canvas {
        max-width: 100vw;
        max-height: 70vh; /* keep room for controls */
        width: auto;
        height: auto;
    }

    body {
        touch-action: pan-y; /* ズーム防止 */
    }
    
    h1 {
        font-size: 18px;
    }
}
