@import url("https://fonts.googleapis.com/css2?family=New+Tegomin&display=swap");
* {
  padding: 0;
  margin: 0;
}

.body {
  /* Background will be set dynamically by config.js from gameAssets.json */
  min-height: 100vh;
  background-size: 100vw 100vh;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
}

.score-div {
  display: flex;
  justify-content: start;
  align-items: center;
  position: absolute;
  flex-direction: column;
  top: 2%;
  left: 2%;
  width: max-content;
}

#scoreBox {
  position: relative;
  font-size: clamp(14px, 4vw, 40px);
  font-weight: bold;
  font-family: "New Tegomin", serif;
  color: var(--scoreTextColor, #1a4d1a);
}

#hiscoreBox {
  position: relative;
  font-size: clamp(14px, 4vw, 40px);
  font-weight: bold;
  font-family: "New Tegomin", serif;
  color: var(--scoreTextColor, #1a4d1a);
}

#board {
  background: var(--boardBackgroundColor, linear-gradient(rgb(170, 236, 170), rgb(236, 236, 167)));
  width: 90vmin;
  height: 92vmin;
  border: 2px solid var(--boardBorderColor, black);
  display: grid;
  grid-template-rows: repeat(18, 1fr);
  grid-template-columns: repeat(18, 1fr);
}

.head {
  background: linear-gradient(var(--snakeHeadGradient1, rgb(240, 124, 124)), var(--snakeHeadGradient2, rgb(228, 228, 129)));
  border: 2px solid var(--primaryColor, rgb(34, 4, 34));
  border-radius: 9px;
  position: relative;
  transition: transform 0.1s ease;
}

.snake-eye {
  position: absolute;
  width: 5px;
  height: 5px;
  background-color: black;
  border-radius: 50%;
  top: 30%;
}

.left-eye {
  left: 25%;
}

.right-eye {
  right: 25%;
}

.snake {
  background-color: var(--snakeBodyBackgroundColor, purple);
  border: 0.25vmin solid var(--snakeBodyBorderColor, white);
  border-radius: 12px;
}

.food {
  background: linear-gradient(var(--foodGradient1, red), var(--foodGradient2, purple));
  border: 0.25vmin solid var(--foodBorderColor, black);
  border-radius: 8px;
}

/* UI Screen Styles */
.ui-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--backdropBlur, rgba(0, 0, 0, 0.8));
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.ui-screen.hidden {
  display: none;
}

.ui-content {
  background: linear-gradient(135deg, var(--popupBackgroundColor, #667eea) 0%, var(--secondaryColor, #764ba2) 100%);
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 40px var(--shadowColor, rgba(0, 0, 0, 0.3));
  max-width: 90%;
  width: 400px;
  border: 3px solid var(--popupBorderColor, rgba(255, 255, 255, 0.2));
}

.ui-content h1 {
  color: var(--titleColor, white);
  font-family: "New Tegomin", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.ui-content h2 {
  color: var(--textColor, white);
  font-family: "New Tegomin", serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin-bottom: 1.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.instructions {
  margin: 1rem 0;
  color: var(--subtitleColor, rgba(255, 255, 255, 0.9));
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  line-height: 1.5;
}

.final-score {
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 10px;
  margin: 1rem 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.final-score p {
  color: var(--textColor, white);
  font-size: clamp(1rem, 3vw, 1.3rem);
  margin: 0.5rem 0;
  font-family: "New Tegomin", serif;
}

.final-score span {
  font-weight: bold;
  color: var(--accentColor, #ffd700);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.ui-button {
  background: linear-gradient(45deg, var(--buttonBackgroundColor, #ff6b6b), var(--accentColor, #ffa500));
  color: var(--buttonTextColor, white);
  border: none;
  padding: 1rem 2rem;
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "New Tegomin", serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 5px 15px var(--buttonShadowColor, rgba(0, 0, 0, 0.3));
  margin-top: 1rem;
  min-width: 150px;
}

.ui-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadowColor, rgba(0, 0, 0, 0.4));
  background: linear-gradient(45deg, var(--buttonHoverColor, #ff5252), var(--accentColor, #ff9800));
}

.ui-button:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px var(--shadowColor, rgba(0, 0, 0, 0.3));
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .ui-content {
    padding: 1.5rem;
    margin: 1rem;
    width: calc(100% - 2rem);
  }

  .ui-button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    min-width: 120px;
  }

  .final-score {
    padding: 0.8rem;
  }
}

@media (max-width: 480px) {
  .ui-content {
    padding: 1rem;
    margin: 0.5rem;
    width: calc(100% - 1rem);
  }

  .ui-button {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    min-width: 100px;
  }
}
