:root {
  --color-correct: #6aaa64;
  --color-present: #c9b458;
  --color-absent: #787c7e;
  --color-background: #ffffff;
  --color-text: #1a1a1b;
  --key-bg: #d3d6da;
  --key-text: #1a1a1b;
  --tile-border-empty: #d3d6da;
  --clue-bg: #f0f0f0;
  --clue-border: #cccccc;

  --hint-bg: #f0f0f0;
  --hint-text: #1a1a1b;
  --hint-revealed-bg: #e9d15c; /* Lighter shade of yellow */
  --hint-revealed-text: #333; /* Changed to black for better contrast */
  --hint-button-bg: #6aaa64;
  --hint-button-text: #ffffff;
  --hint-button-disabled-bg: #787c7e;
}

/* Dark mode variables */
[data-theme="dark"] {
  --color-background: #121213;
  --color-text: #ffffff;
  --key-bg: #818384;
  --key-text: #ffffff;
  --tile-border-empty: #3a3a3c;
  --clue-bg: #2f2f2f;
  --clue-border: #555555;

  /* Dark mode variables for hint section */
  --hint-bg: #2f2f2f;
  --hint-text: #ffffff;
  --hint-revealed-bg: #8c0bc3;
  --hint-revealed-text: #ffffff;
  --hint-button-bg: #538d4e;
  --hint-button-text: #ffffff;
  --hint-button-disabled-bg: #3a3a3c;
}

body {
  font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--color-background);
  color: var(--color-text);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

#game-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  max-height: 800px;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#game-logo {
  font-size: 20px;
  margin: 0;
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

#game-area {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;

  padding: 10px 0;
}

#clues-section {
  margin-bottom: 10px;
}

#clues-section h2 {
  font-size: 18px;
  margin-bottom: 5px;
}

#clues-container {
  background-color: var(--clue-bg);
  border: 1px solid var(--clue-border);
  border-radius: 5px;
  padding: 10px;
}

.clue {
  margin-bottom: 5px;
}

#mini-history {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.mini-history-row {
  display: flex;
  margin-right: 5px;
}

.mini-history-tile {
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  margin: 0 1px;
}

#current-guess {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.current-tile {
  width: 50px;
  height: 50px;
  font-size: 1.8rem;
  margin: 0 2px;
}

#keyboard {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  grid-gap: 5px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 3px;
}

.key {
  font-family: inherit;
  font-weight: bold;
  border: 0;
  padding: 0;
  margin: 0;
  height: 50px;
  border-radius: 4px;
  cursor: pointer;
  background-color: var(--key-bg);
  color: var(--key-text);
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  user-select: none;
}

.key.wide {
  flex: 1.5;
}

#message,
#score-progress {
  text-align: center;
  margin-top: 10px;
}

.tile {
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  text-transform: uppercase;
  border: 2px solid var(--tile-border-empty);
  background-color: var(--color-background);
}

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

.tile.present {
  background-color: var(--color-present);
  border-color: var(--color-present);
  color: white;
}

.tile.absent {
  background-color: var(--color-absent);
  border-color: var(--color-absent);
  color: white;
}

@media (max-height: 600px) {
  #game-container {
    justify-content: flex-start;
  }

  #game-area {
    justify-content: flex-start;
  }

  #clues-section {
    margin-bottom: 10px;
  }

  #mini-history {
    margin-bottom: 10px;
  }

  #current-guess {
    margin-bottom: 15px;
  }
}

#hint-section {
  background-color: var(--hint-bg);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, color 0.3s ease;
}

#hint-section h2 {
  font-size: 1.2em;
  margin-bottom: 10px;
  color: var(--hint-text);
}

#hint-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hint {
  background-color: var(--hint-bg);
  border-radius: 5px;
  padding: 10px;
  font-size: 0.9em;
  color: var(--hint-text);
  transition: all 0.3s ease;
  height: 20px;
  overflow: hidden;
}

.hint.revealed {
  background-color: var(--hint-revealed-bg);
  color: var(--hint-revealed-text);
  height: auto;
}

.hint-button {
  background-color: var(--hint-button-bg);
  border: none;
  color: var(--hint-button-text);
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin-top: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.hint-button:hover {
  filter: brightness(110%);
}

.hint-button:disabled {
  background-color: var(--hint-button-disabled-bg);
  cursor: not-allowed;
}

/* Remove unnecessary dark mode specific styles */
[data-theme="dark"] #hint-section {
  box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

.dialog {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.dialog.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.dialog-content {
  background-color: var(--color-background);
  color: var(--color-text);
  padding: 15px;
  border: 1px solid var(--tile-border-empty);
  border-radius: 5px;
  width: 80%;
  max-width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
  font-size: 0.9em;
}

.dialog h2 {
  font-size: 1.3em;
  margin-bottom: 10px;
}

.dialog h3 {
  font-size: 1.1em;
  margin-top: 15px;
  margin-bottom: 8px;
}

.dialog p,
.dialog li {
  margin-bottom: 8px;
}

.dialog .tile {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 8px;
  vertical-align: middle;
}

.dialog .correct {
  background-color: var(--color-correct);
}

.dialog .present {
  background-color: var(--color-present);
}

.dialog .absent {
  background-color: var(--color-absent);
}

#close-dialog {
  display: block;
  width: 100%;
  margin-top: 15px;
  padding: 10px 15px;
  background-color: var(--color-correct);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  z-index: 1001; /* Ensure the button is above other elements */
}

#close-dialog:hover {
  background-color: var(--hint-button-bg);
}

@media (max-width: 480px) {
  .dialog-content {
    width: 90%;
    max-height: 80vh;
    font-size: 0.85em;
  }

  #close-dialog {
    padding: 15px;
    font-size: 1em;
  }
}
#show-feedback {
  background-color: var(--hint-button-disabled-bg);
  color: var(--hint-button-text);
  border: none;
  padding: 10px 15px;
  margin-top: 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#show-feedback:hover {
  background-color: var(--hint-button-bg);
}
#show-how-to-play {
  background-color: var(--hint-button-disabled-bg);
  color: var(--hint-button-text);
  border: none;
  padding: 7px 10px;
  margin-left: 5px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
#show-how-to-play:hover {
  background-color: var(--hint-button-bg);
}
