* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #0f172a;
  color: #f8fafc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =========================
   Header
   ========================= */

h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* =========================
   Category
   ========================= */

#category {
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: #94a3b8;
}

#category strong {
  font-weight: 600;
}

#categoryText {
  font-weight: 700;
  color: #fbbf24;
  background-color: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 4px 12px;
  border-radius: 9999px;
  margin-left: 6px;
  letter-spacing: 0.025em;
}

/* =========================
   Main Game Container
   ========================= */

.app-container {
  background-color: #1e293b;
  padding: 32px 24px;
  border-radius: 20px;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.4),
    0 8px 10px -6px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);

  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =========================
   Game Board
   ========================= */

#gameBoard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

/* =========================
   Letter Tiles
   ========================= */

.letter {
  width: 58px;
  height: 58px;

  border: 2px solid #334155;
  background-color: #0f172a;
  border-radius: 10px;


  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: #f8fafc;

  text-transform: uppercase;
  outline: none;

  /* Keyboard-only interaction */
  pointer-events: none;
  caret-color: transparent;

  user-select: none;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

/* Active tile */
.letter:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

/* Future rows cannot be selected */
.letter.locked {
  pointer-events: none;
}

/* =========================
   Revealed Letters
   ========================= */

.letter.revealed {
  font-weight: 800;
  border-bottom: 6px solid #fbbf24;
  box-shadow: inset 0 -12px 20px -15px #fbbf24;
}




/* =========================
   Error  Message
   ========================= */

#errorMessage {
  color: transparent;
  background-color: transparent;
  border-radius: 9999px;

  padding: 4px 8px;

  min-height: 24px;
  width: fit-content;

  margin: 8px auto;

  font-weight: 600;
  font-size: 0.95rem;

  display: flex;
  align-items: center;
  justify-content: center;

  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.25s ease;
}

/* Invalid word */
#errorMessage.show {
  color: #f8fafc;
  /*background-color: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);*/
}

/* =========================
   Correct Guess
   ========================= */

.correct .letter {
  background-color: #22c55e;
  color: white;
  border-color: #22c55e;
}

/* Correct answer */
#errorMessage.win {
  color: #0f172a;
  background-color: #4ade80;
  

  font-size: 1.1rem;
  font-weight: 800;

  transform: translateY(-2px);
}


/* Correct answer */
#errorMessage.lose {
  color: #0f172a;
  background-color: #ef4444;

  font-size: 1.1rem;
  font-weight: 800;

  transform: translateY(-2px);
}

/* =========================
   Invalid Guess Animation
   ========================= */

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px);
  }

  40% {
    transform: translateX(8px);
  }

  60% {
    transform: translateX(-8px);
  }

  80% {
    transform: translateX(8px);
  }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* =========================
   Letter Pop Animation
   ========================= */

@keyframes pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.pop {
  animation: pop 0.1s ease-in-out;
}

.rules{
    margin-bottom: 16px;
}



/* =========================
   Loading
   ========================= */
#loadingScreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loadingContent {
  width: 90%;
  max-width: 400px;
  text-align: center;
}

.loadingLogo {
  width: 200px;
  margin-bottom: 20px;
}

.loadingContent h1 {
  font-size: 42px;
  margin: 0 0 10px;
  color: #f8fafc;
}

.loadingContent p {
  color: white;
  font-size: 20px;
  margin: 0 auto 30px;
  max-width: 80%;
}

.loadingArea {
  width: 300px;
  height: 50px;
  margin: 0 auto;
  position: relative;
}

.loadingBar,
#playButton {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.loadingBar {
  width: 50%;
  height: 8px;
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

#loadingProgress {
  width: 0%;
  height: 100%;
  background: #fbbf24;
  transition: width 2s linear;
}

#playButton {
  display: none;
  padding: 12px 35px;
  border: none;
  border-radius: 8px;
  background: #fbbf24;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

#playButton:hover {
  transform: translate(-50%, -50%) scale(1.05);
}


/* =========================
   Bug Fixes
   ========================= */

   /* revealed letters were dimmed so i made the current rows not dimmed */
input.letter.currentreveal:disabled {
  opacity: 1;
}

/* Stop horizontal scrolling */
html,
body {
  overflow-x: hidden;
  overflow-y: hidden;
  touch-action: none;
}


/* =========================
   KEYBOARD
   ========================= */
#keyboard {
  max-width: 100%;
  padding: 8px;
}

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

.keyboard-row button {
  width: 35px;
  height: 50px;
  border: none;
  border-radius: 6px;
  background: #334155;
  color: white;
  font-size: 16px;
  font-weight: bold;
}

.keyboard-row:last-child button:last-child {
  width: 50px;
}



/* =========================
   Winning Screen
   ========================= */

#winScreen {
  position: fixed;
  inset: 0;
  background: #0f172a;

  display: none;
  justify-content: center;
  align-items: center;

  z-index: 9998;
}

.winContent {
  text-align: center;
  margin-bottom: 100px;
}

.winContent h1 {
  font-size: 42px;
  margin-bottom: 20px;
}

.winContent p {
  color: #94a3b8;
  font-size: 18px;
  margin-bottom: 10px;
}

#winningWord {
  font-size: 36px;
  font-weight: 800;
  color: #4ade80;
  margin-bottom: 30px;
}

#playAgainButton {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;

  background: #fbbf24;
  color: #0f172a;

  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}


#guessesText {
  white-space: pre-line;
}




/* =========================
   Losing Screen
   ========================= */

#loseScreen {
  position: fixed;
  inset: 0;
  background: #0f172a;

  display: none;
  justify-content: center;
  align-items: center;

  z-index: 9998;
}

.loseContent {
  text-align: center;
}

.loseContent h1 {
  font-size: 42px;
  margin-bottom: 20px;
}

.loseContent p {
  color: #94a3b8;
  font-size: 18px;
  margin-bottom: 10px;
}

#losingWord {
  font-size: 36px;
  font-weight: 800;
  color: #ef4444;
  margin-bottom: 20px;
}

#loseMessage {
  color: #f8fafc;
  font-weight: 600;
  margin-bottom: 30px;
}

#playAgainLoseButton {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  background: #fbbf24;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}