body {
    margin: 0;
    padding: 0;
    background-color: #87CEEB;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Press Start 2P', cursive;
    color: white;
    user-select: none;
    overflow: hidden;
    touch-action: manipulation;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 12px;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

/* ─── Mute Button ─── */
#mute-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    z-index: 99;
}
#mute-btn:hover { background: rgba(0,0,0,0.75); transform: scale(1.1); }
#mute-btn:active { transform: scale(0.95); }

/* ─── Title / Start Screen ─── */
#title-screen {
    background-color: rgba(0, 0, 0, 0.65);
    padding: 30px 40px;
    border: 4px solid #fff;
    border-radius: 14px;
    text-align: center;
    line-height: 1.8;
    pointer-events: auto;
    max-width: 90vw;
    box-sizing: border-box;
}

#win-screen { border-color: #ffd700; }
#win-screen h1 { color: #ffd700; text-shadow: 2px 2px 0 #000; }
#title-screen h1 {
    display: none;
}

#game-logo {
    max-width: 80%;
    height: auto;
    margin: 0 auto 10px auto;
    display: block;
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.8));
}

.subtitle {
    margin: 14px 0 10px;
    font-size: 0.55em;
    color: #ffd700;
}

#difficulty-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.diff-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.45em;
    padding: 10px 14px;
    border: 2px solid #fff;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s, transform 0.1s;
    touch-action: manipulation;
}
.diff-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.05); }
.diff-btn.active { background: rgba(255,215,0,0.35); border-color: #ffd700; color: #ffd700; }

.start-hint {
    font-size: 0.45em;
    color: #ffd700;
    margin: 6px 0 0;
    animation: blink 1s step-end infinite;
}

/* ─── Game Over ─── */
#game-over-screen,
#win-screen {
    background-color: rgba(0, 0, 0, 0.65);
    padding: 30px 40px;
    border: 4px solid #fff;
    border-radius: 14px;
    text-align: center;
    line-height: 1.8;
    pointer-events: auto;
    cursor: pointer;
    max-width: 90vw;
    box-sizing: border-box;
}

/* ─── Score display ─── */
#score-display {
    position: absolute;
    top: 16px;
    left: 16px;
    font-size: 18px;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ─── Tap hint untuk mobile ─── */
#tap-hint {
    display: none;
    font-size: 0.35em;
    color: #adf;
    margin-top: 8px;
    animation: blink 1s step-end infinite;
}

/* ═══════════════════════════════════════
   MOBILE RESPONSIVE (max 600px)
═══════════════════════════════════════ */
@media (max-width: 600px) {

    #mute-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        top: 10px;
        right: 10px;
    }

    #title-screen,
    #game-over-screen,
#win-screen {
        padding: 20px 18px;
        border-width: 3px;
        border-radius: 10px;
        max-width: 92vw;
    }

    #title-screen h1 {
        font-size: 0.72em;
        margin: 0 0 10px 0;
        word-break: break-word;
    }

    #game-over-screen h1,
#win-screen h1 {
        font-size: 0.75em;
        margin-bottom: 10px;
    }

    #game-over-screen p,
#win-screen p {
        font-size: 0.5em;
    }

    .subtitle {
        font-size: 0.42em;
        margin: 10px 0 8px;
    }

    #difficulty-buttons {
        gap: 6px;
        margin-bottom: 12px;
    }

    .diff-btn {
        font-size: 0.38em;
        padding: 9px 10px;
    }

    .start-hint {
        font-size: 0.36em;
    }

    #tap-hint {
        display: block;
    }

    #score-display {
        font-size: 12px;
        top: 12px;
        left: 12px;
    }
}

/* ═══════════════════════════════════════
   EXTRA SMALL (max 380px / hp kecil)
═══════════════════════════════════════ */
@media (max-width: 380px) {

    #title-screen h1 {
        font-size: 0.58em;
    }

    .diff-btn {
        font-size: 0.32em;
        padding: 8px 8px;
    }

    .start-hint,
    #tap-hint {
        font-size: 0.30em;
    }

    #score-display {
        font-size: 10px;
    }
}
