/* Reset and base styles */
body {
  margin: 0;
  padding: 0;
  background-color: black;
  color: #39ff14; /* neon green */
  font-family: 'Courier New', Courier, monospace;
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Headings and labels */
h2, h3, p {
  color: #39ff14;
  margin-bottom: 16px;
}

h1 {
  color: #39ff14;
  margin-bottom: 16px;
  font-family: 'Orbitron', sans-serif;
}

.footer {
  text-align: center;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  color: #39ff14;
  font-size: 0.9rem;
}

/* Optional: glowing effect for key text */
.glow {
  text-shadow: 0 0 2px #39ff14, 0 0 2px #39ff14;
}

/* Gameplay container with green border */
.game-container {
  /* border: 2px solid #39ff14; */
  padding: 0.5rem;
  border-radius: 8px;
  margin: 0.5rem auto;
  max-width: 600px;
  text-align: center;
}

.game-container.flash {
  background-color: #39ff14;
  transition: background-color 0.2s ease;
}

.letter-box.revealed {
  background-color: #39ff14;
  color: black;
  text-shadow: none;
}

.letter-box.selected {
  background-color: #ffd54f; /* soft yellow highlight */
  border: 2px solid #fbc02d;
}


/* Power meter styling */
.power-meter {
  width: 186px;
  height: 48px;
  border: 4px solid #39ff14;
  border-radius: 5px;
  background-color: black;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px; /* adjusted for spacing */
  margin: 13px auto;
}

.power-bar {
  width: 7px; /* updated width */
  height: 28px;
  background-color: #39ff14;
  transition: background-color 0.3s ease, opacity 0.3s ease;
}

.power-bar.orange {
  background-color: orange;
}

.power-bar.red {
  background-color: red;
}

.power-bar.inactive {
  opacity: 0.2;
}

/* Orientation warning */
#orientationWarning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: black;
  color: #39ff14;
  font-size: 20px;
  font-family: 'Courier New', Courier, monospace;
  text-align: center;
  padding-top: 40vh;
  z-index: 9999;
}


.submit-btn {
  background-color: #39ff14;
  color: black;
  font-weight: bold;
  padding: 0.5rem 1.2rem;
  border: 2px solid #39ff14;
  border-radius: 6px;
  margin: 1rem auto;
  display: block;
  font-size: 1rem;
}

.hidden {
  display: none;
}


/* Game Header */
.game-header {
  text-align: center;
  margin-bottom: 1rem;
}

.title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.game-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 1rem;
  font-weight: bold;
}

/* Letter Grid */
.letter-grid {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 1rem 0;
}

.game-rules {
  text-align: center;
  margin: 0.5rem auto;
  font-size: 1rem;
  font-family: 'Orbitron', sans-serif;
  color: #39ff14;
}

.game-rules a {
  color: #39ff14;
  text-decoration: none;
}



.game-objective {
  position: relative;
  width: 100%;
  height: 1.5rem;
  perspective: 600px;
  margin-bottom: 1rem;
  text-align: center;
}

.game-objective-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

.flip {
  transform: rotateY(180deg);
}

.game-objective-front,
.game-objective-back {
  position: absolute;
  width: 100%;
  height: 100%;
  font-size: 1rem;
  font-weight: bold;
  font-family: 'Orbitron', sans-serif;
  color: #39ff14;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-objective-back {
  transform: rotateY(180deg);
}



.letter-box {
  width: 40px;
  height: 40px;
  border: 2px solid #39ff14;
  background-color: #111;
  color: #39ff14;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  line-height: 40px;
  border-radius: 6px;
}

/* Guess Box */
.guess-box {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 2px solid #39ff14;
  background-color: #222;
  color: #39ff14;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  line-height: 40px;
  border-radius: 6px;
}


.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: #222;
  color: #fff;
  padding: 2rem 3rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 0 20px #ff0040;
  animation: popIn 0.4s ease;
}

.overlay.win .overlay-content {
  box-shadow: 0 0 20px #39ff14;
  border: 2px solid #39ff14;
}


@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/*
@keyframes jiggle {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(3deg); }
  50%  { transform: rotate(-3deg); }
  75%  { transform: rotate(2deg); }
  100% { transform: rotate(0deg); }
}
*/

@keyframes jiggle {
  0%   { transform: rotate(0deg); }
  20%  { transform: rotate(3deg); }
  40%  { transform: rotate(-3deg); }
  60%  { transform: rotate(2deg); }
  80%  { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}


.jiggle {
  animation: jiggle 1.0s ease-in-out;
}




/* Keyboard layout */
/*
#keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  padding: 0 0.75rem;
  box-sizing: border-box;
  transform: scale(1.2);
  transform-origin: top center;
}
*/




#keyboard {
  width: 100%;
  max-width: 100%;
  padding: 1rem;
  box-sizing: border-box;
  transform: scale(1.3); /* alter keyboard size */
  transform-origin: top center;
}


.keyboard-row {
  display: flex;
  width: 100%;
  max-width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
}


/* Key styling */
.key {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  border-radius: 6px;
  background-color: #222;
  color: #39ff14;
  border: 2px solid #39ff14;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease;
}




.key:active {
  transform: scale(0.9);
}

/* Special keys (Enter, Delete) */
.key.special {
  min-width: 45px;
  font-size: 1rem;
  background-color:  #000;
  color: #39ff14;
  font-weight: bold;
}


.key.correct {
  background-color: #39ff14;
  color: black;
  border-color: #39ff14;
  text-shadow: none;
}

.key.incorrect {
  background-color: #111;
  color: #2f8f0a;
  border-color: #2f8f0a;
  opacity: 0.6;
}

.key.used {
  cursor: default;
  opacity: 0.5;
}


/* Responsive tweaks */
@media (max-width: 960px) {
  .key {
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: bold;
  }

  .key.special {
    min-width: 45px;
    font-size: 0.8rem;
  }

  #keyboard {
    transform: scale(1.3);
    transform-origin: top center;
  }
}



/* Responsive tweaks */
@media (max-width: 600px) {
  .key {
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: bold;
  }

  .key.special {
    min-width: 45px;
    font-size: 0.8rem;
  }

      #keyboard {
    transform: scale(1.2);
    transform-origin: top center;
  }

}

@media (max-width: 360px) {
  .key {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 1rem;
    font-weight: bold;
  }

    #keyboard {
    transform: scale(0.95);
    transform-origin: top center;
  }

  .key.special {
    min-width: 45px;
    font-size: 0.9rem;
  }
}

#debug-panel button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #000;
  color: #39ff14;
  border: 2px solid #39ff14;
  padding: 2rem;
  max-width: 600px;
  border-radius: 12px;
  font-family: 'Courier New', Courier, monospace;
  text-align: left;
  box-shadow: 0 0 20px #39ff14;
  overflow-y: auto;
  max-height: 80vh;
  font-size: 1rem;
}

.modal-content h2 {
  margin-top: 0;
  color: #39ff14;
  font-size: 1.2rem;
}

.modal-content a {
  color: #39ff14;
  text-decoration: underline;
}

.modal-content button {
  margin-top: 1rem;
  background-color: #39ff14;
  color: black;
  border: none;
  padding: 0.5rem 1rem;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
}