/* --- START: Styles from Number/style.css for Menu --- */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  /* --- MODIFICATION --- */
  font-family: 'Comic Neue', sans-serif;
  /* Changed from Arial */
  /* --- END MODIFICATION --- */
  text-align: center;
  background: linear-gradient(135deg, #f0f8ff 0%, #e6f7ff 100%);
  /* Subtle gradient */
  overflow: hidden;
  touch-action: manipulation;
}

h1 {
  font-size: 3em;
  margin: 20px 0;
  font-weight: 700;
  text-shadow: 2px 2px 0px #fff;
}

h2 {
  font-size: 2.2em;
  margin: 15px 0;
  font-weight: 700;
  color: #333;
  text-shadow: 2px 2px 0px #fff;
}

.game-screen {
  display: none;
  /* Hidden by default */
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  /* justify-content: center; */
  /* Centering can be bad for scrolling content */
  padding-top: 20px;
  /* Add some padding */
  position: absolute;
  top: 0;
  left: 0;
  overflow-y: auto;
  /* Allow scrolling if content is too tall */
  box-sizing: border-box;
}

.game-screen.visible {
  display: flex;
  /* Show the active screen */
}

.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 1.2em;
  font-weight: 700;
  padding: 10px 20px;
  background-color: #f4f4f4;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 0 #ccc;
  transition: all 0.1s;
}

.back-btn:active {
  transform: translateY(4px);
  box-shadow: none;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.menu-btn {
  font-family: 'Comic Neue', sans-serif;
  /* Using font from other apps */
  font-size: 2.5em;
  font-weight: 700;
  padding: 20px 40px;
  min-width: 300px;
  border-radius: 25px;
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.menu-btn:active {
  transform: translateY(6px);
  box-shadow: none;
}

/* --- BUTTON COLORS --- */
#start-image-game-btn {
  background: linear-gradient(to bottom, #FFC107, #FFA000);
  /* Amber */
}

#start-missing-game-btn {
  background: linear-gradient(to bottom, #4CAF50, #388E3C);
  /* Green */
}

/* NEW */
#start-color-game-btn {
  background: linear-gradient(to bottom, #03A9F4, #0288D1);
  /* Light Blue */
}

/* --- MODIFICATION --- */
/* Standardized class name */
.home-btn-subpage {
  /* --- END MODIFICATION --- */
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 1.8em;
  /* Nice and large icon */
  color: #333;
  text-decoration: none;
  padding: 10px;
  z-index: 100;
  transition: transform 0.1s;
}

/* --- MODIFICATION --- */
.home-btn-subpage:active {
  /* --- END MODIFICATION --- */
  transform: scale(0.9);
}

/* --- END: Styles from Number/style.css for Menu --- */


/* --- START: Original styles from Spelling/style.css --- */
/* Note: body styles are merged above */

/* --- UPDATED CENTERING RULE --- */
#game-container-image,
#game-container-color,
#game-container-missing {
  margin-top: 10px;
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#word-image,
#word-image-missing {
  /* Added new image */
  width: 300px;
  height: 300px;
  object-fit: contain;
  border: 5px solid #ccc;
  border-radius: 10px;
}

/* --- NEW STYLE for Color Game Box --- */
#color-box-display {
  width: 300px;
  height: 300px;
  border: 5px solid #ccc;
  border-radius: 10px;
  /* Background color will be set by JS */
}

.word-blanks {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 30px 0;
}

.blank {
  width: 80px;
  height: 80px;
  border: 4px dashed #aaa;
  font-size: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #333;
  box-sizing: border-box;
  /* Add this for better sizing */
}

/* --- NEW STYLE for pre-filled blanks in color game --- */
.blank.filled {
  border-style: solid;
  color: #666;
  background-color: #eee;
}

.letter-choices {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
}

.letter-button {
  width: 90px;
  height: 90px;
  font-size: 60px;
  font-weight: bold;
  cursor: pointer;
  border: 3px solid #555;
  border-radius: 10px;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

.letter-button:active {
  transform: scale(0.95);
}

/* --- UPDATED NEXT BUTTON RULE --- */
#next-word-button-image,
#next-word-button-color,
#next-word-button-missing {
  font-size: 28px;
  font-weight: bold;
  padding: 20px 30px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 30px;
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  50% {
    transform: translateX(10px);
  }

  75% {
    transform: translateX(-10px);
  }

  100% {
    transform: translateX(0);
  }
}

.hidden {
  display: none;
}

/* --- START: Original Responsive Styles (Adapted) --- */
@media (orientation: landscape) and (max-height: 720px) {
  h1 {
    font-size: 28px;
    margin: 10px 0;
  }

  h2 {
    font-size: 24px;
    margin: 10px 0;
  }

  #game-container-image,
  #game-container-color,
  #game-container-missing {
    margin-top: 5px;
    padding-bottom: 20px;
    /* Add padding for "Next" button */
  }

  #word-image,
  #color-box-display,
  #word-image-missing {
    width: 200px;
    /* Smaller */
    height: 200px;
  }

  .word-blanks {
    margin: 15px 0;
    gap: 10px;
  }

  .blank {
    width: 50px;
    height: 50px;
    font-size: 35px;
    border-width: 3px;
  }

  .letter-choices {
    gap: 10px;
  }

  .letter-button {
    width: 60px;
    height: 60px;
    font-size: 35px;
  }

  #next-word-button-image,
  #next-word-button-color,
  #next-word-button-missing {
    font-size: 18px;
    padding: 12px 20px;
    margin-top: 20px;
  }

  .back-btn {
    font-size: 1em;
    padding: 8px 15px;
    top: 10px;
    left: 10px;
  }

  /* --- MODIFICATION --- */
  .home-btn-subpage {
    /* --- END MODIFICATION --- */
    top: 10px;
    left: 10px;
  }
}

@media (orientation: portrait) and (max-width: 480px) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 24px;
    margin-top: 40px;
    /* Make space for back button */
  }

  #word-image,
  #color-box-display,
  #word-image-missing {
    width: 250px;
    height: 250px;
  }

  .blank {
    width: 50px;
    height: 50px;
    font-size: 30px;
    gap: 10px;
  }

  .letter-button {
    width: 65px;
    height: 65px;
    font-size: 35px;
    gap: 10px;
  }

  .back-btn {
    /* Un-stick it */
    position: static;
    margin-top: 15px;
  }

  /* --- THIS BLOCK WAS REMOVED ---
  .home-btn-spelling {
    left: 50%;
    transform: translateX(-50%);
    top: 15px;
  }
  */

  .menu-buttons {
    align-items: center;
  }

  .menu-btn {
    font-size: 1.8em;
    padding: 15px 20px;
    min-width: 280px;
    width: 90%;
  }
}

@media (orientation: landscape) and (max-height: 450px) {
  h1 {
    font-size: 20px;
    margin: 5px 0;
  }

  h2 {
    font-size: 18px;
    margin: 5px 0;
  }

  #game-container-image,
  #game-container-color,
  #game-container-missing {
    margin-top: 5px;
  }

  #word-image,
  #color-box-display,
  #word-image-missing {
    width: 140px;
    height: 140px;
  }

  .word-blanks {
    margin: 10px 0;
    gap: 8px;
  }

  .blank {
    width: 35px;
    height: 35px;
    font-size: 24px;
    border-width: 2px;
  }

  .letter-choices {
    gap: 8px;
  }

  .letter-button {
    width: 45px;
    height: 45px;
    font-size: 24px;
  }

  #next-word-button-image,
  #next-word-button-color,
  #next-word-button-missing {
    font-size: 16px;
    padding: 10px 15px;
    margin-top: 10px;
    margin-bottom: 10px;
  }
}

/* --- NEW: Level Toggle Button --- */
.level-toggle-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

#level-toggle-btn {
  font-family: 'Comic Neue', sans-serif;
  font-size: 1.5em;
  font-weight: 700;
  padding: 10px 30px;
  border-radius: 30px;
  border: 3px solid #333;
  cursor: pointer;
  background-color: #007BFF;
  /* Blue for Level 1 */
  color: white;
  transition: all 0.2s;
  box-shadow: 0 4px 0 #0056b3;
}

#level-toggle-btn:active {
  transform: translateY(4px);
  box-shadow: none;
}

#level-toggle-btn.level-2 {
  background-color: #dc3545;
  /* Red for Level 2 */
  box-shadow: 0 4px 0 #a71d2a;
}

/* --- NEW: Reading Game Styles --- */
#start-reading-game-btn {
  background-color: #9C27B0;
  /* Purple */
}

.sentence-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 90%;
  max-width: 600px;
  margin-top: 20px;
}

.sentence-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: white;
  border: 3px solid #ccc;
  border-radius: 15px;
  padding: 15px 20px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.2s;
}

.sentence-strip:active {
  transform: scale(0.98);
}

.sentence-text {
  font-size: 1.8em;
  font-weight: 700;
  color: #333;
  text-align: left;
  flex-grow: 1;
  margin-right: 15px;
  user-select: none;
}

.sentence-audio-btn {
  font-size: 1.5em;
  color: #007BFF;
  background: #e3f2fd;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid #007BFF;
  cursor: pointer;
  flex-shrink: 0;
  /* Prevent squishing */
  transition: background-color 0.2s;
}

.sentence-audio-btn:hover {
  background: #bbdefb;
}

.sentence-audio-btn:active {
  transform: scale(0.9);
}

/* Feedback Styles */
.sentence-strip.correct {
  background-color: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.sentence-strip.wrong {
  background-color: #f8d7da;
  border-color: #dc3545;
  animation: shake 0.5s;
}

/* --- Responsive Tweaks for Sentences --- */
@media (max-width: 600px) {
  .sentence-text {
    font-size: 1.4em;
  }

  .sentence-audio-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2em;
  }
}