html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #111;
  font-family: Arial, sans-serif;
  color: #fff;
}

#game {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#window {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    #87ceeb 0%,   /* sky */
    #87ceeb 40%,  
    #4caf50 40%,  /* grass */
    #4caf50 100%
  );
  overflow: hidden;
}

#track-container {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 8%;
  height: 60vh;
  transform: translateX(-50%);
  overflow: visible;
  z-index: 2;
}

/* Lean animations for turns */
#track-container.turn-left {
  animation: leanLeft 0.3s forwards;
}
#track-container.turn-right {
  animation: leanRight 0.3s forwards;
}
@keyframes leanLeft {
  0%   { transform: translateX(-50%) rotate(0deg); }
  50%  { transform: translateX(-45%) rotate(-5deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}
@keyframes leanRight {
  0%   { transform: translateX(-50%) rotate(0deg); }
  50%  { transform: translateX(-55%) rotate(5deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

/* Main straight track */
#track {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, 
    #654321 0px, #654321 20px, #fff 20px, #fff 40px
  );
  background-size: 100% 40px;
  border-left: 6px solid #333;
  border-right: 6px solid #333;
  border-radius: 6px;
  clip-path: polygon(40% 0%, 60% 0%, 100% 100%, 0% 100%);
  animation: none;
}

/* Y-shaped switch track */
#switch-track {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, 
    #654321 0px, #654321 20px, #fff 20px, #fff 40px
  );
  background-size: 100% 40px;
  border-left: 6px solid #333;
  border-right: 6px solid #333;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: clip-path 0.3s ease, opacity 0.3s ease;
}

/* Branch shapes */
.branch-left {
  clip-path: polygon(50% 0%, 0% 0%, 20% 100%, 50% 100%);
}
.branch-right {
  clip-path: polygon(50% 0%, 100% 0%, 80% 100%, 50% 100%);
}

/* Track movement animation */
@keyframes trackMove {
  from { background-position-y: 0; }
  to   { background-position-y: 40px; }
}

#dashboard {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: linear-gradient(#333, #111);
  border-top: 2px solid #555;
  padding: 1.5vh;
  box-sizing: border-box;
  z-index: 5;
}

#message {
  font-size: 2.5vh;
  margin-bottom: 0.5vh;
}

.good { color: #6f6; }
.warning { color: #ff6; }
.oops { color: #6cf; }

