/* Base styles */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background-color: white;
  overflow: hidden;
}

#button-container {
    display: flex;
    gap: 10px; /* Add spacing between buttons */
    justify-content: center; /* Center the buttons horizontally */
    margin-top: 20px; /* Add some top margin */
}

#button-container button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
}

@keyframes quake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.quake {
    animation: quake 0.5s ease;
}

#game-board {
  flex-grow: 1;
  overflow-y: auto;
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 120px;
}

.row-container {
  display: grid;
  grid-template-columns: 40px minmax(auto, 300px) 40px;
  align-items: center;
  padding: 4px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  gap: 4px;
}

.guess-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.empty-spot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #f0f0f0;
  border: 2px solid #ccc;
  flex-shrink: 0;
}

.empty-spot.highlighted {
  border: 2px solid #2196F3;
  box-shadow: 0 0 5px rgba(33, 150, 243, 0.3);
}

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  padding: 15px 10px;
  background-color: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#color-selector {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 5px 0;
}

#color-selector button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #666;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

/* Feedback box styles */
.feedback-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  width: 44px;
  height: 44px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: white;
}

.opponent-feedback-box {
  background-color: #f5f5f5;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.opponent-feedback-box.visible {
  opacity: 1;
}

.feedback-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin: 2px;
  justify-self: center;
  align-self: center;
}

.feedback-dot.exact-match {
  background-color: black;
}

.feedback-dot.color-match {
  background-color: white;
  border: 1px solid black;
}

.common-btn  {
  padding: 8px 25px;
  font-size: 16px;
  cursor: pointer;
  background-color: white;
  border: 2px solid #ccc;
  border-radius: 25px;
  color: #666;
  margin: 0 auto;
}

.common-btn :disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile specific overrides */
@media screen and (max-width: 430px) {
  .row-container {
    max-width: 380px;
    grid-template-columns: 40px minmax(auto, 280px) 40px;
    gap: 3px;
    padding: 3px;
  }

  .empty-spot {
    width: 34px;
    height: 34px;
  }

  #color-selector button {
    width: 42px;
    height: 42px;
  }

  .feedback-box,
  .opponent-feedback-box {
    padding: 3px;
    gap: 1px;
  }

  .feedback-dot {
    width: 6px;
    height: 6px;
  }

  #game-board {
    gap: 8px;
    padding-bottom: 110px;
  }

  .guess-row {
    gap: 8px;
  }

  #color-selector {
    gap: 10px;
  }
}

/* Ensure iOS Safari behaves properly */
html {
  position: fixed;
  height: 100%;
  overflow: hidden;
  width: 100%;
  touch-action: manipulation;
}

body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  height: 100%;
  touch-action: manipulation;
  -webkit-user-select: none;
}

/* Ensure consistent width */
#game-board, 
#controls {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    text-align: center;
    border-radius: 8px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
