body {
  margin: 0;
  overflow: hidden;
  font-family: sans-serif;
}

#ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: white;
  text-shadow: 1px 1px 2px black;
}

.hud-text {
  position: absolute;
  font-family: 'Arial Black', sans-serif;
  font-size: 28px;
  color: #ffc107;
  /* Gold */
  text-shadow: 2px 2px 0px #3e2723, -1px -1px 0 #3e2723, 1px -1px 0 #3e2723, -1px 1px 0 #3e2723, 1px 1px 0 #3e2723;
  /* Strong outline */
  pointer-events: none;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
}
#coin-counter {
  top: 20px;
    left: 20px;
  }
  
  #lives-display {
    top: 20px;
    right: 20px;
    color: #ff3333;
    /* Red hearts */
    letter-spacing: 5px;
  }
  
  #stats-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    pointer-events: none;
    z-index: 10;
  }
  
  #distance-display,
  #speed-display {
    position: relative;
    /* Reset absolute */
    top: auto;
    right: auto;
    bottom: auto;
    font-family: 'Arial Black', sans-serif;
    font-size: 24px;
    /* Slightly smaller than main counters */
    color: #ffc107;
    text-shadow: 2px 2px 0px #3e2723;
  }
  
  .coin-visual {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #b8860b);
    border: 2px solid #3e2723;
    border-radius: 50%;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
  }
  
  .coin-visual::after {
    content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 1px solid #b8860b;
    border-radius: 50%;
}

#game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 500px;
  aspect-ratio: 1/1;
  background-color: #fff8e1;
  display: flex;
    flex-direction: column;
  justify-content: center;
    /* Center content vertically */
    align-items: center;
    z-index: 25;
    pointer-events: auto;
  border: 5px solid #3e2723;
  border-radius: 20px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  padding: 20px;
  }
  
  #game-over-title {
    width: 100%;
    height: 100px;
    /* Adjust based on image aspect ratio */
    background: url('cover/game_over.png') no-repeat center center;
    background-size: contain;
    margin-bottom: 10px;
  }
  
  #score-card {
    text-align: center;
    font-family: 'Arial Black', sans-serif;
    color: #3e2723;
    width: 100%;
    margin-bottom: 20px;
  }
  
  #score-card p {
    margin: 5px 0;
    font-size: 18px;
  }
  
  .ui-button {
    padding: 15px 30px;
    font-size: 24px;
    font-family: 'Arial Black', sans-serif;
    color: #3e2723;
    /* Dark brown */
    background: #ffc107;
    /* Gold */
    border: 4px solid #3e2723;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, background 0.1s;
    margin-bottom: 10%;
      /* Increased from 5% */
    /* Adjusted for popup size */
}

.ui-button:hover {
  transform: scale(1.05);
  background: #ffca28;
}

.ui-button:active {
  transform: scale(0.95);
}
#cover-screen {
  position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  background: rgba(0, 0, 0, 0.5);
    /* Dimmed background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
  }
  
  #start-card {
    width: 80%;
    max-width: 500px;
    aspect-ratio: 1/1;
    background: url('cover/cover_1x1.png') no-repeat center center;
    background-size: cover;
  border: 5px solid #3e2723;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
  position: relative;
}

@media (orientation: portrait) {
  #start-card {
      width: 90%;
  }
}
#cover-menu {
    margin-bottom: 10%;
      /* Adjusted for card */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
      width: 100%;
}

#cover-menu button {
    padding: 15px 30px;
    font-size: 24px;
    font-family: 'Arial Black', sans-serif;
    color: #3e2723; /* Dark brown */
    background: #ffc107; /* Gold */
    border: 4px solid #3e2723;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: transform 0.1s, background 0.1s;
}

#cover-menu button:hover {
    transform: scale(1.05);
    background: #ffca28;
}

#cover-menu button:active {
    transform: scale(0.95);
}

#controls-modal,
#settings-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
}

.modal-content {
    background: #fff8e1;
      padding: 40px;
    border-radius: 15px;
    border: 5px solid #3e2723;
    text-align: center;
    font-family: 'Arial Black', sans-serif;
    color: #3e2723;
    max-width: 500px;
}

.modal-content h2 {
    font-size: 36px;
    margin-top: 0;
    color: #ffc107;
      /* Gold/Yellow to match buttons */
      text-shadow: 2px 2px 0px #3e2723;
      /* Add outline for visibility on light background */
}

.modal-content ul {
    text-align: left;
    font-size: 20px;
      line-height: 1.6;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 20px;
    /* Reduced from 24px */
  margin: 20px 0;
  padding: 0 20px;
  gap: 30px;
    /* Ensure space between label and checkbox */
}

.setting-item input[type="checkbox"] {
  transform: scale(2);
  cursor: pointer;
}

#close-controls,
#close-settings {
    margin-top: 20px;
    padding: 10px 30px;
      font-size: 24px;
      font-family: 'Arial Black', sans-serif;
      color: #3e2723;
      /* Dark brown */
      background: #ffc107;
      /* Gold */
      border: 4px solid #3e2723;
      border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
      transition: transform 0.1s, background 0.1s;
}

#close-controls:hover,
#close-settings:hover {
    transform: scale(1.05);
      background: #ffca28;
    }
    
    #close-controls:active,
    #close-settings:active {
      transform: scale(0.95);
}

/* Shop Styles */
#shop-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
  pointer-events: auto;
}

.shop-content {
  background: #fff8e1;
  padding: 40px;
  border-radius: 15px;
  border: 5px solid #3e2723;
  text-align: center;
  font-family: 'Arial Black', sans-serif;
  color: #3e2723;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.shop-content h1 {
  font-size: 48px;
  margin-top: 0;
  color: #ffc107;
  text-shadow: 2px 2px 0px #3e2723;
  margin-bottom: 30px;
}

.shop-items {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.shop-item {
  background: #fff;
  border: 3px solid #3e2723;
  border-radius: 10px;
  padding: 20px;
  width: 150px;
  cursor: pointer;
  transition: transform 0.1s, background 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.shop-item:hover {
  transform: scale(1.05);
  background: #ffecb3;
}

.shop-item:active {
  transform: scale(0.95);
}

.item-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.item-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 5px;
}

.item-cost {
  font-size: 16px;
  color: #ff8f00;
  font-weight: bold;
}

#leave-shop-button {
  padding: 15px 40px;
  font-size: 24px;
  font-family: 'Arial Black', sans-serif;
  color: #3e2723;
  background: #ffc107;
  border: 4px solid #3e2723;
  border-radius: 10px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s, background 0.1s;
}

#leave-shop-button:hover {
  transform: scale(1.05);
  background: #ffca28;
}

#leave-shop-button:active {
  transform: scale(0.95);
}
@media (max-width: 600px),
(max-height: 600px) {
  #cover-menu button {
    padding: 10px 20px;
    font-size: 18px;
  }

  #cover-menu {
    gap: 10px;
    margin-bottom: 5%;
  }
}