body {
    font-family: Arial, sans-serif;
    background: #87CEEB;
    text-align: center;
    margin: 0;
    overflow-x: hidden;
}

h1 {
    margin-top: 20px;
    font-size: 28px;
}

#container {
    padding: 10px;
    margin: 0 auto;
    width: 500px;
    background-color: transparent;
    border-radius: 12px;
}

#track::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 30px;
    width: 100%;
    background-image: repeating-linear-gradient(
        to right,
        #444 0,
        #444 10px,
        transparent 10px,
        transparent 20px
    );
    background-color: #222;
    z-index: -1;
}


#train {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 130px;
    width: 170px;
    pointer-events: auto;
}

#train img {
    width: 100%;
    height: auto;
}

#smoke {
    position: absolute;
    bottom: 60px;
    left: 40px;
    opacity: 0;
    font-size: 24px;
    transition: opacity 0.2s ease;
}

#stopButton,
#restartButton {
    display: inline-block;
    background-color: white;
    color: red;
    font-size: 20px;
    padding: 10px 20px;
    margin: 10px;
    border-radius: 8px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

#speedDisplay {
    margin-top: 10px;
    font-weight: bold;
    color: navy;
}

.cloud {
    font-size: 48px;
    position: absolute;
    top: 20px;
    animation: moveClouds 60s linear infinite;
}

.cloud1 { left: 0; animation-delay: 0s; }
.cloud2 { left: 200px; animation-delay: 30s; }

@keyframes moveClouds {
    0% { left: -100px; }
    100% { left: 110%; }
}

#sky {
    height: 365px;
    overflow: hidden;
    position: relative;
}

#background {
    background: linear-gradient(to top, lightgreen 0%, transparent 100%);
    height: 80px;
    overflow: hidden;
    position: relative;
}

.tree {
    font-size: 70px;
    position: absolute;
    bottom: 0;
    animation: scrollTrees 20s linear infinite;
}

.tree:nth-child(1) { left: 0%; }
.tree:nth-child(2) { left: 20%; }
.tree:nth-child(3) { left: 40%; }

.tree:nth-child(4) { left: 60%; }
.tree:nth-child(5) { left: 80%; }
.tree:nth-child(6) { left: 100%; }

.tree:nth-child(7) { left: 120%; }
.tree:nth-child(8) { left: 140%; }
.tree:nth-child(9) { left: 160%; }

@keyframes scrollTrees {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100vw); }
}

.shake {
    animation: shake 0.3s ease-in-out infinite;
}

@keyframes shake {
    0% { transform: translate(0px, 0px); }
    25% { transform: translate(2px, 0px); }
    50% { transform: translate(-2px, 0px); }
    75% { transform: translate(2px, 0px); }
    100% { transform: translate(0px, 0px); }
}
