body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  margin: 0;
  padding-top: 50px; /* space for navbar */

  max-width: 100vw;
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

#game-board {
  flex: 1;
  overflow-y: auto; /* allow vertical scroll inside game area */
  padding: 10px 0;
  max-width: 100vw;
  box-sizing: border-box;
}

#navbar {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #4caf50;
  color: #fff;
  padding: 10px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1;
  box-sizing: border-box;
}

#navbar-logo {
  font-size: 1.5em;
  font-weight: bold;
  margin-right: auto;
  padding-left: 2rem;
}

#navbar-icon {
  font-size: 1.5em;
  cursor: pointer;
  padding-right: 2rem;
  font-weight: bold;
}

/* Dropdown container */
#navbar-dropdown {
  position: relative;
  display: inline-block;
  cursor: pointer;
  font-size: 1.5em;
  padding-right: 2rem;
  font-weight: bold;
}

/* Dropdown content */
.dropdown-content {
  display: none;
  position: absolute;
  font-size: 0.667em;

  right: 0;
  background-color: #444;
  min-width: 120px;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 2;
  flex-direction: column;
}

.dropdown-content button {
  color: white;
  background-color: #444;
  border: none;
  padding: 10px;
  text-align: left;
  font-size: 1em;
  cursor: pointer;
  width: 100%;
}

.dropdown-content button:hover {
  background-color: #666;
}

/* Show dropdown on click */
#navbar-dropdown.open .dropdown-content {
  display: flex;
}

#letters {
  margin-top: 100px;
}
@media (max-width: 480px) {
  #letters {
    margin-top: 40px;
  }
}

.letter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.letter-box {
  border: 1px solid #333;
  border-radius: 3px;
  margin: 1px;
  font-size: 1.75em;
  font-weight: 700;
  width: 9vw;
  height: 9vw;
  max-width: 50px;
  max-height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  box-sizing: border-box;
  user-select: none;
}

@media (max-width: 480px) {
  .letter-box {
    width: 9vw;
    height: 9vw;
    font-size: 1.25em;
  }

  #letters {
    margin-top: 40px;
  }
}

.filled-box {
  border: 2px solid black;
}

.correct-box {
  background-color: #b5d9a9;
}

.incorrect-box {
  background-color: #d9a9d2;
}

.start-box {
  background-color: rgb(0, 0, 0, 0.15);
  touch-action: manipulation;
  cursor: pointer;
}

.chunk-group {
  background-color: #f3f3f3;
  border-radius: 6px;
  padding: 1px;
  margin: 1px;
  display: flex;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  flex-wrap: nowrap;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: auto;
}

.chunk-group.placed .letter-box {
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
  text-decoration: line-through;
}

.selected {
  outline: 3px solid #4caf50;
  outline-offset: 2px;
  background-color: #d0f0c0;
}

.word-wrapper {
  display: inline-flex;
  flex-wrap: nowrap;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: auto;
}

.space-placeholder {
  width: 1rem;
}

.check {
  background-color: #28a745;
}
.reset {
  background-color: #007bff;
}
.share {
  background-color: #6f42c1;
}
.hint {
  background-color: #ffc107;
  color: #333;
}
.show-answer {
  background-color: #dc3545;
}

.incorrect {
  background-color: #ffcccc;
  border-color: #ff0000;
}

.revealed {
  background-color: #d1ffd1;
  border-color: #00aa00;
}

#share-popup-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  justify-content: center;
  align-items: center;
  overflow: auto;
  z-index: 10; /* Ensure the popup is above other elements */
}

#share-popup {
  position: relative;
  background: #fff;
  margin-top: 75px;

  padding: 20px;
  border-radius: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#close-share-popup {
  position: absolute;
  top: 10px;
  right: 10px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background-color: #d9a9d2;
  font-weight: bold;
  cursor: pointer;
}

#close-share-popup span {
  color: black;
  font-size: 1.5em;
}

#share-button,
#show-path-button {
  display: none;
  cursor: pointer;
  border-radius: 100px;
  background-color: #000;
  color: white;
  width: 10em;
  height: 3em;
  border: none;
  margin-bottom: 30px;
}

#share-icon {
  vertical-align: middle;
  margin-left: 10px;
  color: white;
}

#close-share-popup,
#close-rules-popup {
  position: absolute;
  top: 10px;
  right: 10px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background-color: #d9a9d2;
  font-weight: bold;
  cursor: pointer;
}

#close-share-popup span {
  color: black;
  font-size: 1.5em;
}

#rules-popup-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  justify-content: center;
  align-items: center;
  z-index: 2;
  overflow: auto;
}

#rules-popup {
  position: relative;
  margin-top: 100px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  text-align: left;
  overflow: auto;
}

#close-rules-popup {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  color: #000;
}
