body {
  font-family: sans-serif;
}

h1, h2, h4 {
  text-align: center;
  font-family: sans-serif;
}

h1 {
  font-weight: 200;
  color: black;
}

h2 {
  font-weight: 100;
}

h3 {
  text-align: center;  
  font-weight: bolder;
}

h4 {
    font-weight: lighter;
  }

.header-title {
  display: flex;
  text-align: center;
  justify-content: center;
  align-items: baseline; /* keeps numbers aligned to text baseline */
  gap: 10px;             /* space between Crypty and number */
}

.header-title h1 {
  margin: 0;
}

.header-title h4 {
  margin: 0;
  font-weight: normal;
  color: #666;
}

#game-board {
    display: flex;
    align-items: center;
    flex-direction: column;
    overflow-x: auto;
  }
  
.clue-row {
  font-size: 1rem;
  font-weight: 300;
  font-family: sans-serif;
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
}


.letter-box {
    border: 2px solid gray;
    border-radius: 3px;
    margin: 2px;
    font-size: 2.5rem;
    font-weight: 700;
    height: 3rem;
    width: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
}

.letter-box-dark {
    background-color: gray;
}

.small-screen .letter-box {
    border-radius: 2px;
    margin: 1px;
    font-size: 1rem;
    font-weight: 500;
    width: 1.5rem;
}
  
.filled-box {
    border: 2px solid black;
}
  
.letter-row {
    display: flex;
}

/* KEYBOARD */
#keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 600px;
  margin: 1rem auto;
  touch-action: manipulation; /* disables double-tap zoom */
}
/* each row is flex */
#keyboard .row {
  display: flex;
  justify-content: center; /* centers the row content */
  gap: 4px;
}

/* base key styles */
.key {
  all: unset;
  display: flex;
  justify-content: center;
  align-items: center;

  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;

  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;

  width: 2.5rem;  /* fixed width for all keys */
  height: 3rem;   /* fixed height */
}

/* special keys wider */
.key.special {
  width: 5rem;
}

/* highlight when key is pressed */
.key:active {
  background: #ccc;  /* grey highlight */
}


/* RESULTS OVERLAY */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75); 
  z-index: 100;
  text-align: center;
  font-size: 2rem;
  border: rgba(0,0,0,0.75);
  justify-content: center;
  align-items: flex-start;
}

#overlay .content {
  margin-top: 5vh;
  width: 80%;
  height: 75%;
  padding: 10px;
  border-radius: 10px;
  max-width: 80%;
  max-height: 80%;
  overflow-y: auto;
  box-sizing: border-box;
  background: white;
}

.solution-row {
  font-size: 0.7rem;
  font-weight: 100;
  font-family: sans-serif;
  padding: 0.1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
}

.solution-row-no-caps {
  font-size: 0.7rem;
  font-weight: 100;
  font-family: sans-serif;
  padding: 0.1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.overlay-message {
  font-size: 1.5rem;
  font-weight: 200;
  font-family: sans-serif;
  padding: 0.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.overlay-message-small {
  font-size: 1rem;
  font-weight: 100;
  font-family: sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
}

.countdown-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px; /* space between countdown and button */
}

.countdown {
  font-size: 0.7rem;
  font-weight: 100;
  font-family: sans-serif;
  padding: 0.1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
}

.ml-onclick-form {
  all: unset;
  margin-top: 10px;
  color: #333;
  background: #fff;
  border: 1px solid #ccc;
  padding: 5px 7px;
  text-decoration: none;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 100;
  text-transform: uppercase;
  text-align: center;
  /* Center horizontally */
  display: block;
  margin: 10px auto 0 auto;
}

.remind-button:hover {
  background: #eee;
}

.overlay-share-button {
  all: unset;
  margin-top: 10px;
  color: #333;
  background: #fff;
  border: 1px solid #ccc;
  padding: 5px 7px;
  text-decoration: none;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 100;
  text-transform: uppercase;
  text-align: center;
  /* Center horizontally */
  display: block;
  margin: 10px auto 0 auto;
}

.overlay-share-button:hover {
  background: #eee;
}



/* FOOTER*/
footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  background: #f1f1f1;
  padding: 4px 8px;
  transition: max-height 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
  font-size: 0.95rem;
  z-index: 200;
}

.footer-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1px;
}

.footer-copy {
  font-size: 0.8rem;
  opacity: 0.7;
}

footer a, footer button {
  all:unset;
  font:inherit;
  margin: 2px;
  text-decoration: none;
  color: #333;
  background: #fff;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

footer a:hover, footer button:hover {
  background: #eee;
}

/* Overlay for "How to Play" */
#howToPlayOverlay {
  font-family: sans-serif;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 1000;
}

#howToPlayOverlay h2 {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}


#howToPlayOverlay h3 {
  text-align: left;  
  font-weight: bolder;
  font-size: 1rem;
  margin-top: 0;
  margin-bottom: 0;
}

#howToPlayOverlay .clue-row {
  font-size: 0.8rem;
  font-weight: 300;
  font-family: sans-serif;
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
}

#howToPlayOverlay .content {
  background: white;
  padding: 15px;
  border-radius: 10px;
  max-width: 90%;
}

#howToPlayOverlay p {
  text-align: left;
  font-family: sans-serif;
  font-size: small;
  margin-top: 0.75em;
  margin-bottom: 0.75em;
}

#howToPlayOverlay button, #howToPlayOverlay a {
  all:unset;
  margin-top: 20px;
  cursor: pointer;
  background: #444;
  color: white;
  padding: 10px 14px;
  text-decoration: none;
  border-radius: 5px;
  display: inline-flex;
  align-items: right;
  gap: 10px;
}

#howToPlayOverlay .close-button {
  position: absolute;
  top: 10px;
  right: 10px;
}

#howToPlayOverlay .feedback-button {
  margin-top: 0;
}

#howToPlayOverlay .play-button {
  margin-top: 0;
  background: green;  
}

#howToPlayOverlay .play-button:hover {
  background: darkgreen;   /* darker on hover */
}

.how-to-letter-row {
  display: flex;
  align-items: center;
  /*margin: 8px 0;
  gap: 4px;*/
}

.how-to-letter-box {
    border: 2px solid gray;
    border-radius: 3px;
    margin: 2px;
    font-size: 1rem;
    font-weight: 700;
    height: 1.5rem;
    width: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
}

.legend-text {
  margin-left: 10px;  /* space after last tile */
  font-size: 0.6rem;
  color: #333;
}

.green {
  background-color: #6aaa64;
  color: white;
}

.yellow {
  background-color: #c9b458;
  color: white;
}

.grey {
  background-color: #787c7e;
  color: white;
}

#howToPlayOverlay .actions {
  display: flex;
  justify-content: center;   /* center horizontally */
  gap: 10px;                 /* space between */
  margin-top: 20px;
}

/* small screen setup */
@media (max-width: 500px) {   
  table {
    font-size: 0.9rem;
  }

  th, td {
    padding: 10px 12px;
  }

  footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .key {
    width: 2rem;
    height: 2.5rem;
    font-size: 0.9rem;
  }

  .key.special {
    width: 4rem;
  }
}
