* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0C0D14;
    color: #fff;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: 16px;
}

/* ── HUD ─────────────────────────────────────────────────── */

#hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    letter-spacing: 1.5px;
}

#score-display {
    color: #00ff88;
    font-weight: bold;
    font-size: 20px;
}

#timer-display {
    color: #ffcc00;
    font-weight: bold;
    font-size: 20px;
}

#timer-display.warning {
    color: #ff4466;
    animation: pulse 0.5s ease-in-out infinite alternate;
}

#high-score-display {
    color: #888;
    font-size: 14px;
}

#combo-display {
    text-align: center;
    height: 28px;
    font-size: 18px;
    font-weight: bold;
    color: #ffcc00;
    letter-spacing: 2px;
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#combo-display.visible {
    opacity: 1;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

/* ── Board ───────────────────────────────────────────────── */

#board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 440px;
    margin: 0 auto;
}

/* ── Hole ────────────────────────────────────────────────── */

.hole {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><text y='28' font-size='28'>🔨</text></svg>") 8 4, pointer;
    overflow: hidden;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, #1a1520 0%, #12101a 60%, #0C0D14 100%);
    box-shadow:
        inset 0 8px 20px rgba(0, 0, 0, 0.8),
        inset 0 -2px 6px rgba(60, 50, 80, 0.2),
        0 2px 10px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.1s ease;
}

.hole::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    background: linear-gradient(to top, #15121e 0%, transparent 100%);
    border-radius: 0 0 50% 50%;
    pointer-events: none;
    z-index: 3;
}

.hole.miss-flash {
    box-shadow:
        inset 0 0 30px rgba(255, 50, 50, 0.5),
        0 0 15px rgba(255, 50, 50, 0.3);
}

/* ── Mole ────────────────────────────────────────────────── */

.mole-wrapper {
    position: absolute;
    bottom: -5%;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 70%;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.hole.active .mole-wrapper {
    transform: translateX(-50%) translateY(15%);
}

.hole.whacked .mole-wrapper {
    transform: translateX(-50%) translateY(15%);
    animation: whackShake 0.3s ease;
}

.hole.hiding .mole-wrapper {
    transform: translateX(-50%) translateY(100%);
    transition: transform 0.15s ease-in;
}

.mole {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}

.mole-body {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 40% 35%, #c4956a, #8B6914);
    border-radius: 50% 50% 45% 45%;
    position: relative;
    box-shadow:
        inset 0 -8px 15px rgba(0, 0, 0, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.4);
}

.mole-face {
    position: absolute;
    top: 20%;
    left: 10%;
    right: 10%;
    bottom: 20%;
}

.eye {
    position: absolute;
    top: 20%;
    width: 22%;
    height: 22%;
    background: #fff;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px #2a1a00;
}

.eye::after {
    content: '';
    position: absolute;
    top: 30%;
    left: 35%;
    width: 40%;
    height: 40%;
    background: #1a0a00;
    border-radius: 50%;
}

.eye.left  { left: 15%; }
.eye.right { right: 15%; }

.hole.whacked .eye::after {
    display: none;
}

.hole.whacked .eye {
    background: none;
    box-shadow: none;
    width: 24%;
    height: 8%;
    top: 30%;
    border-radius: 0;
    border-top: 3px solid #2a1a00;
    transform: rotate(-10deg);
}

.hole.whacked .eye.right {
    transform: rotate(10deg);
}

.nose {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translateX(-50%);
    width: 24%;
    height: 18%;
    background: radial-gradient(circle, #d4785a, #a0553a);
    border-radius: 50%;
}

.mouth {
    position: absolute;
    top: 68%;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: 12%;
    border-bottom: 3px solid #5a3a1a;
    border-radius: 0 0 50% 50%;
}

.hole.whacked .mouth {
    width: 40%;
    height: 20%;
    border: 3px solid #5a3a1a;
    border-radius: 50%;
    background: #3a2a10;
}

/* ── Stars (whacked) ──────────────────────────────────────── */

.stars {
    position: absolute;
    top: -15%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: #ffcc00;
    opacity: 0;
    pointer-events: none;
    text-shadow: 0 0 6px rgba(255, 204, 0, 0.8);
    letter-spacing: 4px;
}

.hole.whacked .stars {
    animation: starsAppear 0.5s ease-out forwards;
}

@keyframes starsAppear {
    0%   { opacity: 0; transform: translateX(-50%) translateY(5px) scale(0.5); }
    40%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.2); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-25px) scale(0.8); }
}

@keyframes whackShake {
    0%   { transform: translateX(-50%) translateY(15%); }
    20%  { transform: translateX(-45%) translateY(15%) rotate(-5deg); }
    40%  { transform: translateX(-55%) translateY(18%) rotate(5deg); }
    60%  { transform: translateX(-48%) translateY(15%) rotate(-3deg); }
    80%  { transform: translateX(-52%) translateY(17%) rotate(2deg); }
    100% { transform: translateX(-50%) translateY(15%) rotate(0deg); }
}

/* ── Score popup (per hole) ──────────────────────────────── */

.score-popup {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    font-weight: bold;
    color: #00ff88;
    pointer-events: none;
    z-index: 10;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
    animation: scoreFloat 0.7s ease-out forwards;
}

.score-popup.bonus {
    color: #ffcc00;
    font-size: 26px;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.7);
}

@keyframes scoreFloat {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.8); }
    50%  { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1.1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-45px) scale(0.9); }
}

/* ── Overlay ─────────────────────────────────────────────── */

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(12, 13, 20, 0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

#overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#overlay-content {
    text-align: center;
}

#overlay-title {
    font-size: 32px;
    letter-spacing: 4px;
    margin-bottom: 12px;
    color: #ffcc00;
}

#overlay-subtitle {
    font-size: 16px;
    color: #888;
    margin-bottom: 24px;
    letter-spacing: 2px;
}

#start-btn {
    background: #00ff88;
    color: #0C0D14;
    border: none;
    padding: 14px 48px;
    font-size: 20px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    border-radius: 6px;
    transition: transform 0.15s ease, background 0.15s ease;
}

#start-btn:hover {
    background: #33ffaa;
    transform: scale(1.05);
}

#start-btn:active {
    transform: scale(0.96);
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 500px) {
    #game-container {
        padding: 10px;
    }
    #board {
        gap: 14px;
    }
    #hud {
        font-size: 13px;
    }
    #score-display,
    #timer-display {
        font-size: 17px;
    }
    #overlay-title {
        font-size: 26px;
    }
}

@media (max-width: 360px) {
    #board {
        gap: 10px;
    }
}
