body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: black;
    color: white;
    touch-action: manipulation;
}

/* Title */
h1 {
    text-align: center;
    margin-top: 10px;
}

/* Controls */
.controls {
    text-align: center;
    margin: 10px;
}

/* GAME CONTAINER */
#gameContainer {
    width: 100%;
    height: 70vh;
}

/* TOP BAR */
#topBar {
    height: 80px;
    background: linear-gradient(90deg, #ff00cc, #ff7eb3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.goal {
    background: yellow;
    color: black;
    padding: 12px 25px;
    font-weight: bold;
    border-radius: 15px;
    font-size: 18px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#scene {
    display: flex;
    height: 100%;
    background: linear-gradient(to bottom, #ff00cc, #66ccff);
}

/* Platforms */
.platform {
    width: 25%;
    background: linear-gradient(to top, #1b5e20, #2e7d32);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5); /* added */
}

/* Trees */
.trees {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 30px;
    display: flex;
    gap: 10px;
}

/* River */
#river {
    width: 50%;
    position: relative;
    overflow: hidden;
}

/* Animated waves */
#river::before {
    content: "";
    position: absolute;
    width: 200%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        #66ccff,
        #66ccff 15px,
        #5bb0e6 15px,
        #5bb0e6 30px
    );
    animation: waterMove 4s linear infinite;
}

/* Water Shine Effect */
#river::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0.2) 0%,
        transparent 50%
    );
    animation: shine 3s infinite;
}

@keyframes waterMove {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes shine {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}


#boat {
    position: absolute;
    bottom: 50px; /* increased */
    left: 10%;
    font-size: 70px; /* increased */
    transition: left 1s ease-in-out;
    animation: floatBoat 2s ease-in-out infinite;
    z-index: 1;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.6)); /* added glow */
}

@keyframes floatBoat {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

#boatPassengers {
    position: absolute;
    bottom: 20px;
    left: 10px;
    display: flex;
    gap: 5px;
}

#boatPassengers .character {
    width: 35px;
    height: 50px;
}


.people {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    z-index: 10;
}

/* Base */
.character {
    width: 50px; /* updated */
    height: 70px; /* updated */
    border-radius: 12px;
    position: relative;
    animation: popIn 0.5s ease;
    transition: transform 0.5s ease; /* updated */
    cursor: pointer;
}

.character:active {
    transform: scale(0.9);
}

/* Walking animation */
.walk {
    animation: walk 0.6s infinite alternate;
}

@keyframes walk {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-5px); }
}

/* Entry animation */
@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Hover animation */
.character:hover {
    transform: translateY(-10px) scale(1.05);
    transition: 0.3s;
}

#output {
    text-align: center;
    margin-top: 15px;
    font-size: 18px;
    animation: fadeIn 0.5s ease; /* added */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#output p:last-child {
    color: #4fc3f7;
    font-weight: bold;
}

#explanationBox {
    width: 90%;
    margin: 10px auto;
    padding: 15px;
    background: #111;
    border-radius: 15px;
    text-align: center;
    font-size: 18px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#explanationText {
    color: #4fc3f7;
    margin-top: 10px;
}

#userControls {
    width: 90%;
    margin: 10px auto;
    padding: 15px;
    background: #222;
    border-radius: 15px;
    text-align: center;
}

#userControls input {
    width: 50px;
    margin: 5px;
    text-align: center;
}

#message {
    margin-top: 10px;
    font-weight: bold;
}

#moveCounterBox {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    margin: 10px;
    color: #ffd54f;
}

#modeSelector {
    text-align: center;
    margin: 10px;
}

#modeSelector button {
    padding: 10px 20px;
    margin: 5px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    background: #4fc3f7;
    font-weight: bold;
    color: black;
}

.selected {
    outline: 3px solid yellow;
}
