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

#game-container {
    position: relative;
    width: 800px;
    height: 450px;
    background-image: linear-gradient(#000044 1px, transparent 1px),
        linear-gradient(90deg, #000044 1px, transparent 1px);
    background-size: 40px 40px;
    background-color: #000022;
    border: 4px solid #444;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

#ui-layer {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

#speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hide-chan {
    position: absolute;
    width: 150px;
    /* 1.5x size (100px * 1.5) */
    height: 270px;
    /* 1.5x size (180px * 1.5) */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    bottom: 50px;
    /* 地面からの高さ */
}

.target {
    background-image: url('moving_hide_chan.PNG');
    /* ターゲットも同じ画像を使う */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.5;
    /* ターゲットは半透明 */
    filter: grayscale(100%);
    /* ターゲットは白黒にして区別 */
    z-index: 1;
}

.moving {
    background-image: url('moving_hide_chan.PNG');
    z-index: 2;
}

#time-shock-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    font-weight: 900;
    color: #ffcc00;
    text-shadow: 4px 4px 0 #ff0000, 0 0 20px #ffff00;
    pointer-events: none;
    z-index: 1000;
    /* Ensure it's on top of everything */
    opacity: 0;
    /* transition removed to rely fully on animation */
}

.shock-active {
    animation: shockAnim 1.5s forwards;
    display: block !important;
    /* Ensure it's visible */
}

@keyframes shockAnim {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -200%) scale(1.5);
    }
}

#game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.hidden {
    display: none !important;
}

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

button:hover {
    background: #ffdd44;
}