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

body {
    font-family: 'Arial', sans-serif;
    background: #00ccff;
    overflow: hidden;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#game-container {
    width: 750px;
    height: 100px;
    position: relative;
    border: 2px solid #333;
    overflow: hidden;
}

#game-screen {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Background */
#background {
    width: 100%;
    height: 100%;
    position: absolute;
}

.sky {
    width: 100%;
    height: 60%;
    background: linear-gradient(to bottom, #87CEEB, #98D8E8);
    position: relative;
    overflow: hidden;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.4); /* 50% more transparent */
    border-radius: 50%;
    z-index: 1;
}

.cloud1 {
    width: 50px;
    height: 24px;
    top: 20%;
    left: 10%;
}

.cloud2 {
    width: 38px;
    height: 18px;
    top: 40%;
    right: 15%;
    background: rgba(255, 255, 255, 0.4);
}

@keyframes cloud1 {
    0% { transform: translateX(-50px); }
    100% { transform: translateX(800px); }
}

@keyframes cloud2 {
    0% { transform: translateX(800px); }
    100% { transform: translateX(-50px); }
}

.water {
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, rgba(70, 130, 180, 0.6), rgba(30, 144, 255, 0.6));
    position: absolute;
    bottom: 0;
    z-index: 3; /* Above rock and shore so they can be seen through it */
    animation: waterWave 3s infinite ease-in-out;
    will-change: transform;
}

@keyframes waterWave {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

.shore {
    width: 80px;
    height: 50px;
    background: linear-gradient(to bottom, #8FBC8F, #228B22);
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 9; /* Behind water so it can be seen through it */
    border-radius: 0 15px 0 0;
}

/* Camera Container */
#camera-container {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.1s ease;
    will-change: transform;
}

/* Ensure obstacle layer is positioned and fills the playfield */
#obstacles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Thrower Character */
#thrower {
    position: absolute;
    left: 30px;
    bottom: 35px;
    z-index: 10;
}

.thrower-body {
    width: 15px;
    height: 30px;
    background: #0B3D91; /* dark blue body */
    border-radius: 8px 8px 4px 4px;
    position: relative;
}

.thrower-head {
    width: 28px; /* slightly wider */
    height: 24px;
    background: #C7A5FF; /* light purple skin */
    border-radius: 50%;
    position: absolute;
    top: -12px;
    left: -6.5px; /* re-center wider head over 15px body */
    z-index: 9; /* behind arm */
}

/* Eyes */
.thrower-head::before,
.thrower-head::after {
    content: '';
    position: absolute;
    top: 50%; /* lower on head */
    width: 4px; /* bigger eyes */
    height: 4px;
    background: #000;
    border-radius: 50%;
}
.thrower-head::before {
    left: 5px;
}
.thrower-head::after {
    right: 5px;
}

.thrower-arm {
    width: 20px;
    height: 8px; /* thicker arm */
    background: #1A56C5; /* slightly lighter blue than body */
    border-radius: 4px;
    position: absolute;
    top: 8px;
    left: 0px; /* anchor closer to top-left of body */
    transform-origin: left center;
    transition: transform 0.1s ease;
    z-index: 11; /* in front of head */
}

/* Hand at the end of the arm */
.thrower-arm::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translate(0, -50%);
    width: 10px;
    height: 10px;
    background: #C7A5FF; /* light purple hand */
    border-radius: 50%;
}

/* Small rock in hand before throw */
.hand-rock {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translate(2px, -50%);
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    z-index: 12; /* ensure visible above arm */
}

/* Rock */
#rock {
    width: 20px;
    height: 10px; /* exactly half as tall as wide */
    background: #000;
    border-radius: 50% / 50%; /* ellipse */
    position: absolute;
    bottom: 0; /* use transform for vertical positioning */
    left: 0;   /* use transform for horizontal positioning */
    z-index: 2; /* Behind water so it can sink under it */
    transition: transform 0.1s ease;
    will-change: transform;
}

#rock.flying {
    transition: none;
}

#rock.sinking {
    transition: none;
}

/* UI Elements */
#ui-overlay {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    z-index: 10;
}

#game-stats {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #fff;
    border-radius: 5px;
    padding: 8px;
    color: white;
    font-size: 12px;
    text-align: right;
}

#game-stats div {
    margin-bottom: 2px;
}

/* Obstacles */
.obstacle {
    position: absolute !important;
    z-index: 4; /* above water surface */
}
.frog, .lily-pad, .fish {
    position: absolute !important;
    display: block;
}

.frog {
    width: 20px;
    height: 15px;
    background: #228B22;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: relative;
}

.frog::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 3px;
    width: 5px;
    height: 5px;
    background: #228B22;
    border-radius: 50%;
}

.frog::after {
    content: '';
    position: absolute;
    top: -3px;
    right: 3px;
    width: 5px;
    height: 5px;
    background: #228B22;
    border-radius: 50%;
}

.lily-pad {
    width: 25px;
    height: 25px;
    background: #90EE90;
    border-radius: 50%;
    border: 1px solid #228B22;
}

.fish {
    width: 18px;
    height: 10px;
    background: #FF6347;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: relative;
    animation: fishJump 2s infinite;
}

.fish::before {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid #FF6347;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}

@keyframes fishJump {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(15deg); }
}

/* Instructions */
#instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ffffff;
    padding: 10px 20px;
    border: 2px solid #3498db;
    border-radius: 8px;
    text-align: center;
    z-index: 10;
    font-size: 15px;
}

#instructions p {
    margin: 2px 0;
}

/* Game Over Screen */
#game-over-screen,
#game-paused-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: none;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.game-over-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 10px 20px;
    text-align: center;
    color: white;
    width: 50%;
    max-width: 600px;
}

.game-over-content h1 {
    font-size: 16px;
    margin-bottom: 5px;
    color: #e74c3c;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.final-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 6px;
    font-size: 12px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.stat-label {
    color: #bdc3c7;
    margin-right: 5px;
}

.stat-value {
    color: #f39c12;
    font-weight: bold;
}

.high-score {
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid #3498db;
    border-radius: 3px;
    padding: 5px;
    margin-bottom: 8px;
    font-size: 8px;
}

.high-score h3 {
    color: #3498db;
    margin-bottom: 3px;
    font-size: 10px;
}

.high-score-stats {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: #ecf0f1;
}

.restart-instruction {
    font-size: 10px;
    color: #95a5a6;
    animation: pulse 2s infinite;
    margin-top: 5px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Splash Effects */
.splash {
    position: absolute;
    width: 25px;
    height: 25px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
    animation: splashEffect 0.5s ease-out forwards;
    pointer-events: none;
}

@keyframes splashEffect {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Boost Effect */
.boost {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent);
    border-radius: 50%;
    animation: boostEffect 0.3s ease-out forwards;
    pointer-events: none;
}

@keyframes boostEffect {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

