/* Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Inconsolata:wght@200..900&family=Oxygen:wght@300;400;700&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Sour+Gummy:ital,wght@0,100..900;1,100..900&display=swap');


*,
*::after,
*::before {
  margin: 0;
  padding: 0;
  top: 20%;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --light: white;
  --dark: #3a3a3a;
  --purple: #6416b3;
  --orange: #ed490e;
  --dark: black;

}


body {
  font-family: "Poppins", "Oxygen", "Helvetica Neue", "Roboto", "Helvetica", "Arial", "Lucida Grande",
    "Sour Gummy",
    -apple-system,
    "BlinkMacSystemFont",
    'Segoe UI',
    "Ubuntu",
    "Cantarell",
    'Open Sans',
    'Helvetica Neue',
    sans-serif;
  color: #222222;
  margin: 0;
  padding: 0;
  background-image: url("../images/animal_alphabet.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  min-height: 100vh;
  scroll-behavior: smooth;
  overflow: hidden;
  align-items: center;

  /* transition: all 1.1s ease; */

  -webkit-animation: delayReverse 0.7s ease 0s 1 normal;
  -moz-animation: delayReverse 0.7s ease 0s 1 normal;
  -ms-animation: delayReverse 0.7s ease 0s 1 normal;
  animation: delayReverse 0.7s ease 0s 1 normal;

}

/* canvas {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgb(9, 9, 9);
  width: max-content;
  height: fit-content;
} */

.water_balloon {
  display: none;
}

.navbar {
  /* border-bottom: 2px solid #333; */
  padding: 15px;
  text-align: center;
  margin-bottom: 0;
  position: relative;
}

hr {
  border: 1px double black;
  height: 5px;
  color: #e07800;
  background-color: #e07800;
}

.brand {
  font-family: "Poppins", "Sour Gummy",
    "Oxygen",
    "Roboto",
    -apple-system,
    "BlinkMacSystemFont",
    'Segoe UI',
    "Ubuntu",
    "Cantarell",
    'Open Sans',
    'Helvetica Neue',
    sans-serif;
  font-optical-sizing: auto;
  margin-top: 50px;
  font-weight: 500;
  font-size: 30px;
  letter-spacing: 4px;
}

.container {
  cursor: pointer;
  position: absolute;
  left: 50%;
  transform: translate(-50%);
  padding: 40px;
  border: 4px solid black;
  width: auto;
  background-color: grey;
  box-shadow: 2px 2px 2px black;
}

.scoreboard {
  max-width: 295px;
  width: 100%;
  margin: 10px auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  row-gap: 10px;
  column-gap: 5px;
  margin-bottom: 30px;
}

.scoreboard-letter {
  height: 45px;
  width: 45px;
  font-size: 30px;
  text-transform: uppercase;
  border: 2px solid #030303;
  box-shadow: 0.5px 0.5px 0.5px rgba(70, 70, 70, 0.8) 0.5px 0.5px 0.5px inset;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.correct {
  background-color: darkgreen;
  color: white;
}

.close {
  background-color: goldenrod;
  color: white;
}

.wrong {
  background-color: #888;
  color: white;
}

.invalid {
  animation: flash 1s;
}

.building_blocks {
  position: fixed;
  left: 50%;
  top: 75%;
  transform: translate(-50%);
}


.button_container {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin-top: 20px;
}

/* Start of: Play Again button */
p {
  width: 100%;
  text-align: center;
  font-size: 46px;
  text-shadow: 0px 0px 5px rgba(0, 0, 0, 1);
}

.button_container {
  position: absolute;
  left: 50%;
  top: 80%;
  transform: translate(-50%);
  text-align: center;
  font-weight: 400;
}


.confetti_controls {
  cursor: pointer;
  left: 2%;
}

#confetti_play {
  cursor: pointer;
  position: absolute;
  top: 87%;
  left: 2%;
}

#confetti_play:hover {
  -webkit-animation: shake 4s ease 0s 1 normal;
  -moz-animation: shake 4s ease 0s 1 normal;
  -ms-animation: shake 4s ease 0s 1 normal;
  animation: shake 4s ease 0s 1 normal;
}

#balloon_play {
  cursor: pointer;
  position: absolute;
  top: 87%;
  right: 2%;
}

#balloon_play:hover {
  -webkit-animation: elastic 2s ease 0s 1 normal;
  -moz-animation: elastic 2s ease 0s 1 normal;
  -ms-animation: elastic 2s ease 0s 1 normal;
  animation: elastic 2s ease 0s 1 normal;
}

.btn {
  z-index: 99999999;
  font-family: "Poppins",
    "Sour Gummy";
  font-size: 28px;
  background: rgba(50, 50, 50, 1);
  color: rgba(255, 255, 255, 0.7);
  padding: 15px;
  width: auto;
  text-align: center;
  margin: 0px 10px;
  border-radius: 2px;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0px 0px 10px 2px rgba(0, 0, 0, 0.8);
  transition: 0.2s;
}

.btn:hover {
  box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.9);
  -webkit-box-shadow: 0px 0px 50px 33px #303030;
  -moz-box-shadow: 0px 0px 50px 33px #303030;
  box-shadow: 0px 0px 50px 33px #303030;

  border-top: 1px solid whitesmoke;
  background: rgba(55, 55, 55, 1);
  color: #e07800;
  cursor: pointer;
}

.btn:before {
  content: '';
  display: block;
  height: 5px;
  width: 110px;
  background: -webkit-linear-gradient(left, rgba(242, 133, 0, 0.5) 0%, rgba(2242, 133, 0, 1) 50%, rgba(242, 133, 0, 0.5) 100%);
  position: relative;
  left: 35px;
  top: 50px;
  box-shadow: 0px 0px 5px 1px rgba(240, 130, 10, 0.3);
  transition: 0.1s;
}

.btn:hover:before {
  background: -webkit-linear-gradient(left, rgba(242, 133, 0, 1) 0%, rgba(255, 216, 171, 1) 50%, rgba(242, 133, 0, 1) 100%);
  box-shadow: 0px 0px 7px 2px rgba(240, 130, 10, 0.4);
}

.ice:active:before {
  background: -webkit-linear-gradient(left, rgba(89, 230, 235, 1) 0%, rgba(207, 250, 252, 1) 50%, rgba(89, 230, 235, 1) 100%);
  box-shadow: 0px 0px 7px 2px rgba(89, 230, 235, 1);
}

/* End of: Play again button */

/* End of: Confetti */

/* flashes red border and then fades back to gray */
@keyframes flash {
  5% {
    border-color: crimson;
  }

  100% {
    border-color: #ccc;
  }
}

.spiral {
  font-size: 40px;
  animation: spin 1.5s linear infinite;
}

/* rotates clockwise indefinitely */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* visibility hidden means the item is still there and taking up space
   but just not shown. display: none doesn't take up space */
.hidden {
  visibility: hidden;
}

.info-bar {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* winner animation */
@keyframes rainbow {

  100%,
  0% {
    color: rgb(255, 0, 0);
  }

  8% {
    color: rgb(255, 127, 0);
  }

  16% {
    color: rgb(255, 255, 0);
  }

  25% {
    color: rgb(127, 255, 0);
  }

  33% {
    color: rgb(0, 255, 0);
  }

  41% {
    color: rgb(0, 255, 127);
  }

  50% {
    color: rgb(0, 255, 255);
  }

  58% {
    color: rgb(0, 127, 255);
  }

  66% {
    color: rgb(0, 0, 255);
  }

  75% {
    color: rgb(127, 0, 255);
  }

  83% {
    color: rgb(255, 0, 255);
  }

  91% {
    color: rgb(255, 0, 127);
  }
}

.winner {
  animation: rainbow 4s infinite linear;
}

/* Mobile Keyboard Styles */
.virtual-keyboard {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 5px;
  background: rgba(50, 50, 50, 0.95);
  border-top: 2px solid #e07800;
  z-index: 1000;
  display: none;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 6px;
}

.virtual-key {
  font-family: "Poppins", "Oxygen";
  background: #333;
  color: white;
  border: 1px solid #e07800;
  padding: 8px;
  min-width: 28px;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  touch-action: manipulation;
}

.virtual-key:active {
  background: #e07800;
  transform: scale(0.95);
}

.keyboard-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(50, 50, 50, 0.95);
  color: white;
  border: 2px solid #e07800;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.2s;
  display: none;
  touch-action: manipulation;
}

.keyboard-toggle:active {
  transform: scale(0.95);
  background: #e07800;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .keyboard-toggle {
    display: block;
  }

  /* Add padding to bottom of container to prevent keyboard overlap */
  body {
    padding-bottom: 240px;
  }

  .container {
    margin-bottom: 0;
  }

  .scoreboard {
    margin-bottom: 20px;
  }


  .button_container {
    margin-top: 15px;
  }

  /* Adjust balloon and confetti controls */
  .balloon_controls {
    position: fixed;
    bottom: 140px;
    right: 20px;
    left: auto;
  }

  .confetti_controls {
    position: fixed;
    bottom: 140px;
    left: 20px;
    right: auto;
  }

  /* Adjust balloon and confetti icon sizes */
  .balloon_icon,
  .confetti_icon {
    height: 60px !important;
    width: auto !important;
  }

  /* Adjust scoreboard for better mobile visibility */
  .scoreboard {
    gap: 4px;
    padding: 10px;
  }

  .scoreboard-letter {
    width: 45px;
    height: 45px;
    font-size: 28px;
  }
}

/* Small screen adjustments */
@media (max-width: 480px) {
  .scoreboard {
    margin-bottom: 15px;
  }


  .button_container {
    margin-top: 10px;
  }
}

/* Very small screen adjustments */
@media (max-width: 360px) {
  .scoreboard {
    margin-bottom: 10px;
  }

  .button_container {
    margin-top: 8px;
  }
}

/* When virtual keyboard is visible */
.virtual-keyboard-visible .building_blocks,
.virtual-keyboard-visible .button_container {
  margin-bottom: 260px;
}

/* Responsive Styles */
/* Small devices (up to 480px) */
@media (max-width: 480px) {

  html,
  body {
    margin-left: 3px;
  }

  img {
    border: 2px solid black;
  }

  .brand {
    font-size: 24px;
  }

  .spiral {
    font-size: 30px;
  }

  .scoreboard {
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
  }

  .scoreboard-letter {
    height: 40px;
    width: 40px;
    font-size: 24px;
  }

  .btn {
    font-size: 22px;
    width: 180px;
  }

  .btn:before {
    content: '';
    display: block;
    width: 170px;
    background: none;
    box-shadow: none;
  }

  .btn:hover:before {
    background: none;
    box-shadow: none;
  }


  #confetti_stop,
  #confetti_play,
  #balloon_play {
    display: none;
  }
}

/* Medium devices (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .brand {
    font-size: 26px;
  }

  .spiral {
    font-size: 35px;
  }

  .scoreboard {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .scoreboard-letter {
    height: 42px;
    width: 42px;
    font-size: 26px;
  }

  #confetti_stop,
  #confetti_play,
  #balloon_play {
    display: none;
  }
}

/* Large devices (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .brand {
    font-size: 28px;
  }

  .spiral {
    font-size: 38px;
  }

  .scoreboard {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .scoreboard-letter {
    height: 45px;
    width: 45px;
    font-size: 28px;
  }

  #confetti_stop,
  #confetti_play,
  #balloon_play {
    display: none;
  }
}

/* Extra-large devices (1025px and up) */
@media (min-width: 1025px) {
  .brand {
    font-size: 30px;
  }

  .spiral {
    font-size: 40px;
  }

  .scoreboard {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
  }

  .scoreboard-letter {
    height: 50px;
    width: 50px;
    font-size: 30px;
  }


  .button_container {
    top: 85%;
  }
}

.instructions-btn {
  background: none;
  border: none;
  color: whitesmoke;
  font-size: 1.8rem;
  cursor: pointer;
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease, color 0.3s ease;
  z-index: 100;
  padding: 8px;
}

.instructions-btn:hover {
  transform: translateY(-50%) scale(1.1);
  color: #ffd700;
}

.instructions-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.instructions-modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: #1a1a1a;
  border-radius: 10px;
  padding: 2rem;
  margin: auto;
  max-width: 600px;
  width: 90%;
  position: relative;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.instructions-modal.show .modal-content {
  transform: translateY(0);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: whitesmoke;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease;
}

.close-btn:hover {
  transform: scale(1.1);
}

.instructions-content {
  margin-top: 1rem;
  color: whitesmoke;
}

.instructions-content ul {
  text-align: left;
  padding-left: 1rem;
}

.instructions-content li {
  margin: 0.8rem 0;
  line-height: 1.4;
}