@import url('./root.css');

h1{
  text-align: center;
}

h2{
  font-size: 3rem;
}

header{
  align-items: center;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr 3fr 1fr;
  height: calc(20vh - 4rem);
  padding: 0 2rem;
}
header > div{
  justify-self: end;
}
header img{
  height: 40px;
  width: 40px;
}

/* Board */

.board-row{
  display: flex;
  gap: 1rem;
}

.board-tile{
  aspect-ratio : 1 / 1;
  background-color: transparent;
  border-radius: 1rem;
  cursor: pointer;
  flex-grow: 1;
  perspective: 1000px;
  user-select: none;
}

.board-tile-inner{
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.board-tile-selected .board-tile-inner {
  transform: rotateY(180deg);
}

.board-tile-front, .board-tile-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden; /* Safari */
  backface-visibility: hidden;
}

.board-tile-front {
  background-color: var(--secondary);
  background-image: url('../icons/brain.svg');
  background-blend-mode: overlay;
  background-size: cover;
  background-repeat:   no-repeat;
  background-position: center center;
  border-radius: 1rem;
}

/* Style the back side */
.board-tile-back {
  background-color: var(--primary);
  border-radius: 1rem;
  transform: rotateY(180deg);
}
.board-tile-back > img{
  border-radius: 1rem;
  height: 100%;
  user-select: none;
  width: 100%;
}

.board-tile-removed {
  transition: opacity 0.5s;
  cursor: default;
  opacity: 0;
}

.dummy-tile{
  aspect-ratio : 1 / 1;
  background-color: var(--secondary);
  border-radius: 1rem;
  flex-grow: 1;
}

#board{
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: min(80vh, 90vw);
  padding: 2rem 1rem;
  margin: auto;
  width: min(80vh, 90vw);
}


/* Difficulty selector */

.difficulty-radio{
  font-size: 1.5rem;
  padding: 0.5rem;
}

.difficulty-selector{
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(4, 1fr);
  padding: 2rem;
}
.difficulty-selector > div{
  align-items: center;
  
  background-color: var(--secondary);
  border-radius: 2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-size: 2.5rem;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  width: calc(100% - 4rem);
}

#difficulty-box{
  align-items: center;
  background-color: hsla(0, 0%, 50%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: center;
  left: 0;
  position: absolute;
  top: 0;
  width: 100vw;
  z-index: 10;
}
#difficulty-box > div{
  background-color: var(--background);
  border-radius: var(--border-radius);
  font-size: 2rem;
  margin: 1rem;
  padding: 2rem;
  width: calc(90vw - 4rem);
}

/* End popup */

.end-box{
  display: none;
  opacity: 0;
  align-items: center;
  background-color: hsla(0, 0%, 50%, 0.5);
  flex-direction: column;
  height: 100vh;
  justify-content: center;
  left: 0;
  position: absolute;
  top: 0;
  width: 100vw;
  z-index: 20;
}
.end-box > div{
  background-color: var(--background);
  background-image: url('../img/kid-drawing-4.png');
  background-blend-mode: normal;
  background-size: cover;
  background-repeat:   no-repeat;
  background-position: center center;
  border-radius: var(--border-radius);
  height: 80vh;
  width: 90vw;
}
.end-box > div > div:first-child{
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 90%;
  justify-content: center;
}

.end-box-buttons{
  align-items: center;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  height: 10%;
  justify-items: center;
}
.end-box-buttons > a{
  align-items: center;
  background-color: hsla(221, 100%, 60%);
  color: var(--background);
  display: flex;
  height: 100%;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  transition: 0.15s;
  width: 100%;
}
.end-box-buttons > a:hover{
  background-color: var(--primary);
}
.end-box-buttons > a:first-child{
  border-radius: 0 0 0 var(--border-radius);
}
.end-box-buttons > a:last-child{
  border-radius: 0 0 var(--border-radius) 0;
}

.end-info{
  font-size: 1.5rem;
}

.main-page-button{
  background-color: var(--primary);
  border-radius: var(--border-radius);
  color: var(--background);
  margin-top: 1rem;
  padding: 1rem;
  text-decoration: none;
  transition: 0.25s;
}
.main-page-button:hover{
  background-color: var(--accent);
}

.game-ended{
  opacity: 1;
  transition: opacity 1s;
}

.winner-box{
  text-align: center;
}

@media (max-width: 850px) {
  .difficulty-selector{
    grid-template-columns: repeat(2, 1fr);
    padding: 2rem 0;
  }
}