/* ダブルタップズーム/スクロール防止 */
html {
    touch-action: manipulation;  /* ダブルタップズームを無効化 */
    -webkit-tap-highlight-color: transparent;  /* タップハイライト無効 */
}

body {
    margin: 0;
    padding: 0;
    background-color: #001f3f;
    /* Deep sea blue */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Courier New', Courier, monospace;
    touch-action: none;  /* すべてのタッチジェスチャーを無効化 */
    background-color: #000;
    /* Letterbox color */
    /* 縦横両方のスクロールを完全に禁止 */
    overscroll-behavior: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#game-container {
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

canvas {
    display: block;
    background-color: #0074D9;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.overlay {
    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.5);
    color: white;
    text-align: center;
    pointer-events: none;
    /* Let clicks pass through to canvas if needed, but we handle start differently */
}

.overlay h1 {
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

.overlay p {
    font-size: 18px;
    margin: 10px 0;
}

#start-screen p:last-child {
    animation: blink 1s infinite;
}

.hidden {
    display: none !important;
}

button {
    pointer-events: auto;
    padding: 10px 20px;
    font-size: 16px;
    font-family: inherit;
    background-color: #FF851B;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 20px;
}

button:hover {
    background-color: #FFDC00;
    color: black;
}

#new-record-popup,
#level-up-popup {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #FFDC00;
    font-size: 36px;
    font-weight: bold;
    text-shadow: 3px 3px 0 #000;
    pointer-events: none;
    animation: popAndFade 2s forwards;
    white-space: nowrap;
}

#level-up-popup {
    color: #2ECC40;
    /* Green for Level Up */
    top: 30%;
    /* Slightly lower than New Record */
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

@keyframes popAndFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    40% {
        transform: translate(-50%, -50%) scale(1.0);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -100%);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -150%);
    }
}