/* TypeNinja - Main Stylesheet */

/* Font imports */
@font-face {
  font-family: 'OpenDyslexic';
  src: url('../assets/fonts/OpenDyslexic-Regular.woff2') format('woff2'),
       url('../assets/fonts/OpenDyslexic-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'OpenDyslexic';
  src: url('../assets/fonts/OpenDyslexic-Bold.woff2') format('woff2'),
       url('../assets/fonts/OpenDyslexic-Bold.woff') format('woff');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'OpenDyslexic';
  src: url('../assets/fonts/OpenDyslexic-Italic.woff2') format('woff2'),
       url('../assets/fonts/OpenDyslexic-Italic.woff') format('woff');
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: 'OpenDyslexic';
  src: url('../assets/fonts/OpenDyslexic-Bold-Italic.woff2') format('woff2'),
       url('../assets/fonts/OpenDyslexic-Bold-Italic.woff') format('woff');
  font-weight: bold;
  font-style: italic;
}

/* CSS Variables for consistent theming */
:root {
  --primary-color: #ff758c; /* Cherry blossom pink */
  --secondary-color: #6a8d73; /* Bamboo green */
  --background-color: #f8f9fa;
  --text-color: #333;
  --accent-color: #ff4757; /* Bright red accent */
  --menu-bg-color: rgba(255, 255, 255, 0.9);
  --shadow-color: rgba(0, 0, 0, 0.2);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'OpenDyslexic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Game Container */
.game-container {
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  max-height: 800px;
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 10px 30px var(--shadow-color);
  overflow: hidden;
}

/* Game Header */
.game-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  grid-gap: 10px;
  padding: 10px 20px;
  background-color: var(--secondary-color);
  color: white;
  font-size: 1.2rem;
  z-index: 10;
}

/* Level display */
.level-container {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #8B4513;
  border-radius: 10px;
  padding: 5px 10px;
  border: 2px solid #FFD700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.level-label {
  font-size: 0.8rem;
  font-weight: bold;
  color: #FFD700;
  text-transform: uppercase;
}

.level-number {
  font-size: 1.8rem;
  font-weight: bold;
  color: #FFD700;
  font-family: 'OpenDyslexic', cursive, sans-serif;
  text-shadow: 1px 1px 2px black;
}

/* Coin Container Styling */
.coin-container {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #FFD700;
  border-radius: 20px;
  padding: 5px 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  border: 3px solid #FFA500;
  animation: bounce 0.5s ease infinite alternate;
  font-weight: bold;
  font-size: 1.4rem;
  color: #8B4513;
  text-shadow: 1px 1px 2px white;
}

.coin-icon {
  font-size: 1.8rem;
  margin-right: 8px;
  animation: spin 2s linear infinite;
  filter: drop-shadow(0 0 5px gold);
  color: #FFD700; /* Ensure the coin emoji is gold colored */
}

#coins, #coins-to-level, #total-coins {
  font-family: 'OpenDyslexic', cursive, sans-serif;
  color: #8B4513; /* Brown text color for contrast */
}

/* Progress bar */
.progress-container {
  grid-column: 1 / span 3;
  grid-row: 2;
  width: 100%;
  height: 15px;
  background-color: #8B4513;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #FFD700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #FFD700, #FFA500);
  border-radius: 8px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px #FFD700;
}

/* Stats container */
.stats-container {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.total-coins-container {
  display: flex;
  align-items: center;
  gap: 5px;
  background-color: rgba(255, 215, 0, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.total-label {
  color: #FFD700;
  font-weight: bold;
}

/* Animations for coin display */
@keyframes bounce {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-3px);
  }
}

@keyframes spin {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(360deg);
  }
}

/* Game over screen stats display */
.final-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.8rem;
  margin-bottom: 2rem;
  background-color: #FFD700;
  padding: 15px 25px;
  border-radius: 15px;
  border: 4px solid #FFA500;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  color: #8B4513;
  animation: glow 1.5s ease-in-out infinite alternate;
}

.treasure-chest {
  font-size: 3rem;
  margin-bottom: 10px;
  animation: shake 0.5s ease-in-out infinite alternate;
  color: #FFD700; /* Gold color for the treasure chest */
  text-shadow: 0 0 10px #FFA500; /* Orange glow around the chest */
}

.final-level {
  font-weight: bold;
  margin-bottom: 10px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.final-coins {
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

@keyframes glow {
  from {
    box-shadow: 0 0 10px gold, 0 0 20px gold;
  }
  to {
    box-shadow: 0 0 15px gold, 0 0 30px gold;
  }
}

@keyframes shake {
  from {
    transform: rotate(-5deg);
  }
  to {
    transform: rotate(5deg);
  }
}

.lives-container {
  display: flex;
  gap: 5px;
}

/* Game Area with Canvas */
.game-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #f5f5f5;
}

.game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Typing Area */
.typing-area {
  height: 60px;
  background-color: var(--secondary-color);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  z-index: 10;
}

.typing-feedback {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 10px 25px;
  min-width: 70%;
  text-align: center;
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  color: var(--accent-color);
  border: 2px solid var(--primary-color);
}

/* Game Menu */
.game-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/images/splashscreen.jpeg');
  background-size: contain;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  z-index: 100;
  padding-bottom: 50px;
}

.game-title {
  font-size: 4rem;
  color: var(--primary-color);
  margin-bottom: 2rem;
  text-shadow: 2px 2px 4px var(--shadow-color);
  font-weight: bold;
  letter-spacing: 2px;
}

.menu-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 30px;
  border-radius: 15px;
  margin-bottom: 30px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.menu-button {
  background-color: #FFD700; /* Gold color */
  color: #8B4513; /* Brown text */
  border: 3px solid #FFA500; /* Orange border */
  padding: 15px 40px;
  font-size: 1.4rem;
  font-weight: bold;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
  font-family: 'OpenDyslexic', cursive, sans-serif;
  letter-spacing: 1px;
}

.menu-button:hover {
  background-color: #FFA500; /* Orange on hover */
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.6);
  text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.7);
}

.game-description {
  margin-top: 20px;
  font-size: 1.2rem;
  color: white;
  text-align: center;
  max-width: 400px;
  line-height: 1.5;
  padding: 15px;
  border-radius: 10px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* Game Over Screen */
.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/images/splashscreen.jpeg');
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.game-over h2 {
  font-size: 3.5rem;
  color: #FFD700;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 15px #FFA500, 0 0 30px rgba(0, 0, 0, 0.7);
  background-color: rgba(0, 0, 0, 0.6);
  padding: 15px 40px;
  border-radius: 15px;
  border: 3px solid #FFA500;
}

.final-score {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

/* Level up notification */
.level-up-notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 0 20px #FFA500, 0 0 40px #FF8C00;
  z-index: 1000;
  font-family: 'OpenDyslexic', cursive, sans-serif;
  animation: levelUpAnimation 3s ease-out forwards;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 20px 40px;
  border-radius: 20px;
  border: 4px solid #FFA500;
}

@keyframes levelUpAnimation {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Utility Classes */
.hidden {
  display: none;
}
