/* Wordle Game Styles */

.wordle-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  background: var(--dark);
  color: var(--light);
}

.wordle-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  justify-content: center;
}

.wordle-game-section {
  flex: 1;
  min-width: 0;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#invalid-word-message {
  display: none;
  text-align: center;
  color: #ff4444;
  margin-bottom: 1rem;
  font-weight: 600;
}

.wordle-header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.wordle-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.wordle-header p {
  opacity: 0.8;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.how-to-play-btn {
  margin-top: 0.5rem;
  padding: 0.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--light);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: 'Bricolage Grotesque', sans-serif;
  transition: all 0.2s ease;
}

.how-to-play-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary);
}

/* Game Board */
#game-board {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.tile {
  width: 60px;
  height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  background: transparent;
  color: var(--light);
  transition: all 0.3s ease;
}

.tile.filled {
  border-color: rgba(255, 255, 255, 0.5);
}

.tile.correct {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--dark);
}

.tile.present {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--dark);
}

.tile.absent {
  background: #333;
  border-color: #333;
  opacity: 0.5;
}

/* Flip Animation */
.tile.flip {
  animation: flip 0.6s ease;
}

@keyframes flip {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0);
  }
}

/* Shake Animation */
.row.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Keyboard */
#keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  max-width: 600px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.keyboard-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: nowrap;
}

.keyboard-key {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: var(--light);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: 'Bricolage Grotesque', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.keyboard-key:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.keyboard-key:active {
  transform: scale(0.95);
}

.keyboard-row:first-child .keyboard-key {
  flex: 0 1 auto;
  min-width: 35px;
}

.keyboard-row:nth-child(2) .keyboard-key {
  flex: 0 1 auto;
  min-width: 35px;
}

.keyboard-row:last-child .keyboard-key {
  flex: 0 1 auto;
  min-width: 35px;
}

.keyboard-key.enter-key,
.keyboard-key.backspace-key {
  flex: 1.2;
  min-width: 60px;
  font-size: 0.75rem;
}

.keyboard-key[data-state="correct"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--dark);
}

.keyboard-key[data-state="present"] {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--dark);
}

.keyboard-key[data-state="absent"] {
  background: #333;
  border-color: #333;
  opacity: 0.5;
}

/* Leaderboard */
.leaderboard-section {
  width: 100%;
  max-width: 600px;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: none; /* Hidden by default */
  margin-top: 2rem;
}

.leaderboard-section.active {
  display: block; /* Show when active */
}

.mobile-leaderboard-btn {
  display: block; /* Show on all screen sizes */
  position: relative;
  margin: 2rem auto 0;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--light);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: 'Bricolage Grotesque', sans-serif;
  transition: all 0.2s ease;
  width: fit-content;
}

.mobile-leaderboard-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary);
}

.leaderboard-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

#leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.leaderboard-entry:hover {
  background: rgba(255, 255, 255, 0.1);
}

.leaderboard-entry .rank {
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
}

.leaderboard-entry .email {
  flex: 1;
  text-align: left;
  margin-left: 1rem;
  text-transform: capitalize;
}

.leaderboard-entry .score {
  font-weight: 700;
  color: var(--primary);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--dark);
  border: 2px solid var(--primary);
  border-radius: 8px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--light);
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.modal-close:hover {
  opacity: 1;
}

.modal-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.modal-content p {
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

#score-display {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1rem 0;
}

#score-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#score-name,
#score-email {
  padding: 0.75rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: var(--light);
  border-radius: 4px;
  font-size: 1rem;
  font-family: 'Bricolage Grotesque', sans-serif;
}

#score-name:focus,
#score-email:focus {
  outline: none;
  border-color: var(--primary);
}

#score-submit {
  padding: 0.75rem;
  background: var(--primary);
  color: var(--dark);
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
  font-family: 'Bricolage Grotesque', sans-serif;
}

#score-submit:hover:not(:disabled) {
  background: #00cc00;
}

#score-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#score-message {
  margin-top: 1rem;
  font-size: 0.9rem;
}

#score-message.success {
  color: var(--primary);
}

#score-message.error {
  color: #ff4444;
}

#answer-display {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1rem 0;
  letter-spacing: 0.2em;
}

/* How to Play Modal Styles */
.how-to-play-content {
  max-width: 500px;
  text-align: left;
}

.how-to-play-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--light);
  font-family: 'Bricolage Grotesque', sans-serif;
}

.how-to-play-main {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.how-to-play-rules {
  list-style: none;
  padding: 0;
  margin-bottom: 2rem;
}

.how-to-play-rules li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
  opacity: 0.9;
}

.how-to-play-rules li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 1.5rem;
  line-height: 1;
}

.how-to-play-examples-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
  margin-top: 2rem;
  color: var(--light);
}

.how-to-play-example {
  margin-bottom: 2rem;
}

.example-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  justify-content: flex-start;
}

.example-tile {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: var(--light);
  border-radius: 4px;
}

.example-tile.correct {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--dark);
}

.example-tile.present {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--dark);
}

.example-tile.absent {
  background: #333;
  border-color: #333;
  opacity: 0.5;
}

.example-text {
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0;
}

.example-text strong {
  font-weight: 700;
  color: var(--light);
}

.how-to-play-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 2rem 0;
}

.how-to-play-info {
  margin-top: 1.5rem;
}

.how-to-play-info p {
  font-size: 0.95rem;
  opacity: 0.8;
  margin: 0;
  line-height: 1.6;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
  .wordle-content {
    flex-direction: column;
    align-items: center;
  }

  .wordle-game-section {
    max-width: 100%;
  }

  .leaderboard-section {
    width: 100%;
    max-width: 600px;
    margin-top: 2rem;
  }
}

@media screen and (max-width: 768px) {
  .wordle-container {
    padding: 1rem;
  }

  .wordle-header {
    position: relative;
  }

  .how-to-play-btn {
    font-size: 0.85rem;
    padding: 0.4rem 1.2rem;
  }

  .how-to-play-content {
    max-width: 100%;
    padding: 1.5rem;
  }

  .example-tile {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }

  .how-to-play-title {
    font-size: 1.5rem;
  }


  .wordle-header h1 {
    font-size: 2rem;
  }

  .tile {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }

  #keyboard {
    transform: scale(1.25);
    transform-origin: center;
    margin-bottom: 3rem;
  }

  .keyboard-key {
    height: 45px;
    padding: 0 0.4rem;
    font-size: 0.75rem;
  }

  .keyboard-row:first-child .keyboard-key,
  .keyboard-row:nth-child(2) .keyboard-key,
  .keyboard-row:last-child .keyboard-key {
    min-width: 28px;
  }

  .keyboard-key.enter-key,
  .keyboard-key.backspace-key {
    min-width: 55px;
    font-size: 0.65rem;
  }

  .modal-content {
    padding: 1.5rem;
  }

  #score-display {
    font-size: 2.5rem;
  }
}

@media screen and (max-width: 480px) {
  .tile {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }

  .keyboard-key {
    height: 40px;
    padding: 0 0.3rem;
    font-size: 0.7rem;
  }

  .keyboard-row:first-child .keyboard-key,
  .keyboard-row:nth-child(2) .keyboard-key,
  .keyboard-row:last-child .keyboard-key {
    min-width: 25px;
  }

  .keyboard-key.enter-key,
  .keyboard-key.backspace-key {
    min-width: 50px;
    font-size: 0.6rem;
  }
}

