/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

main {
  width: 100%;
  max-width: 600px;
}

#error {
  color: #d94a4a;
  background-color: #ffe6e6;
  border: 2px solid #d94a4a;
  border-radius: 4px;
  padding: 12px;
  margin: 10px 0;
  text-align: center;
  font-weight: 600;
}

#gameSection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Polaroid Container */
.polaroid-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: center;
}

#polaroidImage {
  width: 100%;
  height: auto;
  display: block;
}

/* Game Title */
#gameTitle {
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  margin: 10px 0;
}

/* Input Section */
#guessInput {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

.autocomplete-wrapper {
  flex: 1;
  position: relative;
}

#personInput {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #d3d6da;
  border-radius: 4px;
  background-color: white;
}

#personInput:focus {
  outline: none;
  border-color: #6aaa64;
}

.autocomplete-items {
  position: absolute;
  border: 2px solid #d3d6da;
  border-top: none;
  z-index: 99;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background-color: white;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-items div {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.autocomplete-items div:hover,
.autocomplete-items div.autocomplete-active {
  background-color: #6aaa64;
  color: white;
}

.autocomplete-items div:last-child {
  border-bottom: none;
}

#guessButton {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  background-color: #6aaa64;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#guessButton:hover {
  background-color: #5a9a54;
}

#guessButton:disabled {
  background-color: #d3d6da;
  cursor: not-allowed;
}

/* Guesses Container */
#guessesContainer {
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: center;
}

/* Guess Grid Table */
.guess-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  margin-top: 20px;
}

.guess-table th {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px 4px;
  color: #787c7e;
  border-bottom: 1px solid #d3d6da;
  width: 50px;
  word-wrap: break-word;
  word-break: break-all;
  white-space: normal;
}

.guess-table td {
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
  font-weight: 600;
  border-radius: 4px;
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  height: 50px;
  min-height: 50px;
  max-height: 50px;
  word-wrap: break-word;
  word-break: break-all;
  white-space: normal;
  padding: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

/* Color Coding */
.match-exact {
  background-color: #6aaa64;
  color: white;
}

.match-partial {
  background-color: #c9b458;
  color: white;
}

.match-none {
  background-color: #d94a4a;
  color: white;
}

/* Responsive Design */
@media (max-width: 600px) {
  .polaroid-container {
    max-width: 90vw;
  }

  #gameTitle {
    font-size: 24px;
  }

  .guess-table th,
  .guess-table td {
    font-size: 11px;
    padding: 8px 4px;
  }

  .question-mark {
    font-size: 80px;
  }
}

@media (max-width: 400px) {
  .guess-table th,
  .guess-table td {
    font-size: 10px;
    padding: 6px 2px;
  }
}

