
body {
  font-family: Arial;
  background: #ffffff;;
  text-align: center;
  margin: 0;
  padding-top: 5px;
}

h1 { font-size: 2em; color: #333; margin-bottom: 10px; }

#stats1 {
  padding-top: 30px;

  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 0.9em;
  margin-bottom: 5px;
  align-items: center;
}

#stats1 div { margin: 3px; }

#stats2 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 0.9em;
  margin-bottom: 5px;
  align-items: center;
}

#stats2 div { margin: 8px; }

#grid {
  position: relative;
  margin: auto;
  width: min(90vw, 640px);
  height: min(75vw, 590px);
}

.cell {
  position: absolute;
  width: 22%;      /* wide enough for 4 columns */
  height: 12%;      /* much shorter to make a rectangle */
  line-height: 1.2em;
  border-radius: 0;
  border: 2px solid #aaa;
  cursor: pointer;
  user-select: none;
  background-color: #fff;
  font-weight: bold;
  font-size: 1.25em;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: top 0.8s ease, left 0.8s ease, transform 0.8s ease;
  z-index: 1;
  text-align: center;

 -webkit-tap-highlight-color: transparent; /* remove default blue highlight */
  -webkit-user-select: none;                /* prevent selection */
  -webkit-touch-callout: none;             /* prevent context menu */
  touch-action: manipulation;              /* prevent default gestures */
  user-select: none;
}

.cell.selected { background-color: #d0f0ff; box-shadow: 0 0 10px #676798; }
  
.cell.incorrect { animation: shake 0.4s; background-color: #ffffff !important; box-shadow: none !important; transform: none !important; }
 
.cell.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}


.group0 { background-color: #AB63F8 !important; color: #ffffff; }
.group1 { background-color: #F863EB !important; color: #ffffff; }
.group2 { background-color: #FF9B17 !important; color: #ffffff; }
.group3 { background-color: #FF2617 !important; color: #ffffff; }

.categoryLabel {
  position: absolute;
  font-weight: bold;
  font-size: 0.8em;
  color: #333;
  white-space: nowrap;
  line-height: 1.2em;
}

#newGameBtn {
  padding: 3px 6px;
  font-size: 1em;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background-color: #20C920;
  color: #fff;
}
#undoBtn {
  padding: 3px 6px;
  font-size: 1em;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background-color: #206FC9;
  color: #fff;
}
#endGameBtn {
  padding: 3px 6px;
  font-size: 1em;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background-color: #FA380F;
  color: #fff;
}

#soundToggleBtn {
  padding: 3px 6px;
  font-size: 1em;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background-color: #4F4F4F;
  color: #fff;
}


#message {
  padding: 3px 6px;
  font-size: 1.5em;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background-color: #ffffff;
  color: #000;

position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);

  padding: 10px 20px;
  z-index: 1000;

  background: #FBBBFC;
  color: black;
  border-radius: 8px;

  border: 1px solid #ccc;   /* subtle outline */
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);

  pointer-events: none;
}


#newGameBtn:hover {
  background-color: #1F4C02;
}
#undoBtn:hover {
  background-color: #02084C;
}
#endGameBtn:hover {
  background-color: #70120B;
}
#soundToggleBtn:hover {
  background-color: #1A1A1A;
}


@media (max-width: 480px){
  .cell { font-size: 0.8em; line-height: 1.1em; }
  #stats { font-size: 0.9em; gap: 10px; }
}

/* RESET on iOS
.incorrect {
  animation: shake 0.4s;
  background-color: #ffffff !important;
  box-shadow: none !important;
  transform: none !important;
}

