* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #7b5b34 0%, #4e2f10 100%);
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    color: #333;
    
}

.game-wrapper {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%; /* Changed to 100% for full width on small screens */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
    margin: 0 auto; /* Center it */
}

.game-wrapper:hover {
    transform: translateY(-2px);
}

/* Header Section */
.game-header {
    text-align: center;
    margin-bottom: 1.5rem; /* Reduced for smaller screens */
}

.game-title {
    font-size: clamp(1.8rem, 5vw, 2.5rem); /* Responsive font size */
    font-weight: 800;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px; /* Reduced spacing for small screens */
}

.game-subtitle {
    color: #666;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: 400;
    line-height: 1.4;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* More flexible minmax */
    gap: 0.75rem; /* Reduced gap */
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    padding: 1rem; /* Reduced padding */
    border-radius: 16px;
    color: white;
    text-align: center;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.3);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(139, 69, 19, 0.4);
}

.stat-label {
    font-size: 0.8rem; /* Slightly smaller */
    opacity: 0.9;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-value {
    font-size: clamp(1.5rem, 6vw, 2.2rem); /* Responsive font size */
    font-weight: 700;
    line-height: 1;
}

.stat-card.score {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
}

.stat-card.timer {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
}

.stat-card.level {
    background: linear-gradient(135deg, #45B7D1 0%, #96C93D 100%);
}

.stat-card.target {
    background: linear-gradient(135deg, #FECA57 0%, #FF9FF3 100%);
}

/* Game Grid */
.game-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem; /* Reduced gap for smaller screens */
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.1) 0%, rgba(160, 82, 45, 0.05) 100%);
    border-radius: 20px;
    border: 2px solid rgba(139, 69, 19, 0.2);
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.1);
    justify-items: center; /* Center holes in grid cells */
}

.hole {
    width: clamp(80px, 25vw, 120px); /* Responsive width using clamp */
    height: clamp(80px, 25vw, 120px); /* Responsive height */
    background: radial-gradient(ellipse at center, #5D4037 0%, #4E342E 60%, #3E2723 100%);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 8px 20px rgba(0, 0, 0, 0.6),
        0 6px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.hole::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    background: radial-gradient(ellipse, #3E2723 0%, #1B1B1B 100%);
    border-radius: 50% 50% 0 0;
}

.hole:hover {
    transform: scale(1.03);
}

.hole:hover::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    z-index: -1;
}

.mole {
    position: absolute;
    width: 85%;
    height: 85%;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    transition: bottom 0.25s ease, transform 0.25s ease;
    cursor: pointer;
}

.mole::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: url('mole.png') center center / contain no-repeat;
    filter: brightness(0.9) saturate(0.8);
}

.mole::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    box-shadow: 20px 0 0 #000;
}

.hole.active .mole {
    bottom: 15%;
    animation: peek 0.4s ease-in-out;
}

@keyframes peek {
    0%, 100% {
        bottom: 15%;
        transform: translateX(-50%) scale(1);
    }
    50% {
        bottom: 25%;
        transform: translateX(-50%) scale(1.05);
    }
}

.hole.whacked .mole {
    animation: whack 0.3s ease-out forwards;
}

@keyframes whack {
    0% {
        bottom: 15%;
        transform: translateX(-50%) scale(1);
    }
    30% {
        transform: translateX(-50%) scale(0.9) rotate(-15deg);
    }
    100% {
        bottom: -100%;
        transform: translateX(-50%) scale(0.3) rotate(90deg);
    }
}

/* Control Buttons */
.controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: clamp(0.8rem, 3vw, 1.2rem) clamp(1.5rem, 4vw, 2.5rem); /* Responsive padding */
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    min-width: clamp(100px, 30vw, 140px); /* Responsive min-width */
    flex: 1; /* Allow buttons to grow on small screens */
    max-width: 200px; /* Prevent too wide on large screens */
}

.btn-start {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: white;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
}

.btn-reset:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
    padding: 1rem; /* Add padding for small screens */
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    padding: clamp(1.5rem, 5vw, 3rem); /* Responsive padding */
    border-radius: 24px;
    text-align: center;
    max-width: 450px;
    width: 100%; /* Full width on small screens */
    max-height: 90vh; /* Prevent overflow on small screens */
    overflow-y: auto; /* Scroll if needed */
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-title {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-message {
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: #555;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-weight: 400;
}

.modal-stats {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.1) 0%, rgba(160, 82, 45, 0.05) 100%);
    padding: 1rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(139, 69, 19, 0.2);
}

.modal-stat {
    font-size: clamp(1rem, 3vw, 1.3rem);
    margin: 0.5rem 0;
    color: #333;
    font-weight: 500;
}

.modal-stat strong {
    color: #8B4513;
    font-weight: 700;
}

/* Hit Effect */
.hit-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.5rem, 5vw, 2.5rem); /* Responsive font size */
    font-weight: 700;
    color: #FF6B6B;
    animation: hitPop 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes hitPop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -100%) scale(1);
    }
}

/* Mud Splash Effect */
@keyframes mudSplash {
    0% { 
        transform: scale(0.8) rotate(0deg); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.3) rotate(10deg); 
        opacity: 0.7; 
    }
    100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 0; 
    }
}

.mud-splash {
    position: absolute;
    width: clamp(50px, 15vw, 80px); /* Responsive size */
    height: clamp(50px, 15vw, 80px);
    background: radial-gradient(circle, rgba(139, 69, 19, 0.8) 0%, rgba(160, 82, 45, 0.4) 50%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: mudSplash 0.6s ease-out forwards;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@media screen and (min-width:480px)
{
    body{
        padding: 0.5rem;
    }
}
/* Additional Responsive Media Queries for Fine-Tuning */
@media screen and (max-width: 480px) {


    .game-wrapper {
        padding: 1rem;
        border-radius: 12px;
    }

    .game-header {
        margin-bottom: 1rem;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .game-container {
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .controls {
        gap: 0.5rem;
    }

    .btn {
        min-width: 100px;
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        padding: 1.5rem;
        border-radius: 16px;
    }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
    .stats-bar {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }

    .game-container {
        gap: 1rem;
        padding: 1.25rem;
    }
}
