/* ===================================
   RESET & BASE STYLES
   =================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  font-family: monospace;
  height: 100vh;
  width: 100vw;
}

/* ===================================
   HTML ELEMENT SLECTERS
   =================================== */

h1 {
  text-transform: uppercase;
  margin-top: -10px;
}

h3 {
  text-transform: uppercase;
}

a {
  color: #fff;
  font-weight: 900;
}

/* ===================================
   ANIMATION
   =================================== */

@keyframes scaleDown {

  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(0);
  }
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ===================================
   UNIVERSAL
   =================================== 
*/
.not-available {
  cursor: not-allowed !important;
  opacity: 75%;
  filter: grayscale(100%);
}


/* ===================================
   GAME GRID
   =================================== 
*/

.grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(90vw, 560px);
  height: min(90vw, 560px);
  aspect-ratio: 1;
  margin: 10px auto;
  background-color: #00000089;
  padding: 4px;
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) inset; */
  border-radius: 5px;
}

.grid div {
  width: 100%;
  height: 100%;
  border-radius: 25%;
  box-sizing: border-box;
  border: solid 2px #000;
  background-size: cover;
  background-position: center;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: background-image 0.3s ease;
}

.grid div:hover {
  cursor: crosshair;
}

.grid div:active {
  box-sizing: border-box;
  border: solid 2px #0f0;
}

.grid div.matched {
  animation: scaleDown 0.2s ease-in forwards;
}

@media (hover: none) {
  .grid div:hover {
    cursor: pointer;
  }
}

/* ===================================
   SCOREBOARD & TIMER
   =================================== 
*/

.scoreBoard {
  color: #000;
  border: solid 2px #000;
  background: #ffffff88;
  border-radius: 8px;
  width: min(90vw, 560px);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.score-container,
.timer-container {
  display: flex;
  flex-direction: column;
  text-align: center;
  flex: 1;
}

.score-container h3,
.timer-container h3 {
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  margin: 0 0 4px 0;
  font-weight: 400;
}

.score-container p,
.timer-container p {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  margin: 0;
  font-weight: 700;
}

#score {
  color: #000;
}

#timer {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: #ff6b6b;
  margin: 0;
  font-weight: 700;
}

#timer.time-warning {
  color: #ff6b6b;
  animation: blink 0.5s infinite;
}

/* ===================================
   START MENU & BUTTONS
   =================================== 
*/
.homeBtn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999999;
  border: solid 2px #fff;
  color: white;
  background: #32323288;
  padding: 10px 15px;
  border-radius: 5px;
  letter-spacing: 0.5ch;
  transition: all 250ms ease;
}
.homeBtn:hover {
  transform: scale(1.05);
  letter-spacing: 0.6ch;
}

.start {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  gap: 10vw;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.baby {
  background: #1e1e1e;
  color: white;
  font-size: clamp(1.2em, 4vw, 2.5em);
  font-weight: bold;
  padding: clamp(15px, 4vw, 40px) clamp(30px, 8vw, 80px);
  border: solid 2px #fff;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  -webkit-user-select: none;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  min-width: 44px;
}

.baby:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

@media (hover: hover) {
  .baby:hover {
    transform: scale(1.05);
  }
}

/* ===================================
   LAYOUT COMPONENTS
   =================================== 
*/

.jibesh-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.footer {
  width: 100%;
  background: #00000088;
  color: #ffffff;
  text-align: center;
  padding: 15px;
  font-size: clamp(0.75rem, 2vw, 1rem);
  border-top: 2px solid #000;
  margin-top: auto;
}

.footer p {
  margin: 0;
  font-family: monospace;
}

/* ===================================
   RESPONSIVITY
   =================================== 
*/

@media (max-width: 600px) {
  .grid {
    margin: 1vh 0;
   }

  .scoreBoard {
    margin: 10vh 0 0 0;
    padding: 10px;
  }

  .start {
    z-index: 9999;
  }

  .inst-desk {
    display: none;
  }
}

@media (min-width: 600px) {
  .inst-mob {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .scoreBoard {
    padding: 8px;
  }

  .grid {
    margin: 4px auto;
  }
}