html {
  background-color: black;
  width:  100%;
  height: 100%;
  display: flex;
  justify-content: center;
  font-family: 'Merriweather', serif;
  margin: 0;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: row;
  justify-content: center;
  background-color: #fdf1e6;
  border: 1vmin solid #444;
  margin: 1vmin;
  overflow: visible;
  border-radius: 1.5vmin;
}
@media (orientation: portrait) {
  body {
    width: 100%;
    flex-direction: column-reverse;
  }
}

#board {
  width:     var(--size);
  height:    var(--size);
  font-size: var(--size);
  display: grid;
  grid-template-columns: repeat(5, 20%);
  grid-template-rows:    repeat(5, 20%);
  align-self: center;
  touch-action: none;
}
@media (orientation: landscape) {
  #board {
    --size: min(96vh, 100vw - 45vh);
  }
}
@media (orientation: portrait) {
  #board {
    --size: min(96vw, 65vh);
  }
}

.square {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.1em;
  font-weight: bold;
  color: #1f2131;
  text-shadow: 0 0 3vmin white, 0 0 5px white;
  width:  90%;
  height: 90%;
  margin: 5%;
  border-radius: 1vmin;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.square::before {
  opacity: 0.3;
}
.square:hover::before {
  opacity: 0.6;
}
.square.filled {
  box-shadow: 0.3vmin 0.3vmin 2vmin 0.5vmin black;
  transform: scale(1.05);
}
.square.filled::before {
  opacity: 1;
}
.square.filled::before {
  box-shadow: inset -1vmin -1vmin 1vmin rgba(0,0,0,0.23), inset 1vmin 1vmin 1vmin rgba(255,255,255,0.55);
}
.square.active {
  color: white;
  font-size: 0.15em;
  text-shadow: 0 0 5vmin white, 0 0 2vmin black;
  z-index: 2;
}
.square.active:hover {
  outline-width: 1.5vmin;
  outline-offset: 0.5vmin;
}
.square::before {
  content: '';
  display: block;
  position: absolute;
  width:  100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: contain;
  z-index: -1;
}

img[src="images/azul_logo.svg"] {
  background-color: white;
  box-shadow: inset 0 0 6vmin #000000ad;
  border-radius: 1vmin;
  flex-grow: 1;
}

#panel {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #444;
  width: 40vmin;
  align-self: stretch;
}
#panel .buttons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding-top:    1vmin;
  padding-bottom: 1vmin;
}
#panel .buttons button {
  height: 7vmin;
  flex-grow: 1;
}
#panel .buttons button:first-of-type {
  margin-right: 1vmin;
}
#panel .bonuses {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
}
#panel .left-group {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.scores {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin: -0.5vmin;
}

button {
  border-radius: 1vmin;
  border: 0.3vmin solid #56371d;
  background-color: #f5ede3;
  box-shadow: inset -0.7vmin -0.7vmin 0.7vmin rgba(0,0,0,0.23), inset 0.7vmin 0.7vmin 0.7vmin rgba(255,255,255,0.55);
  text-shadow: rgb(0, 0, 0) 0.14vmin 0.14vmin 0.14vmin;
  font-size: 3vmin;
  color: #797979;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
button::-moz-focus-inner {
  border: 0;
}
button:hover {
  background-color: #fbf7f2;
}
button:focus {
  outline: none;
}
button:active {
  box-shadow: inset -0.7vmin -0.7vmin 0.7vmin rgba(255,255,255,0.55), inset 0.7vmin 0.7vmin 0.7vmin rgba(0,0,0,0.23);
}

.score-box {
  background-color: #289fd1;
  min-width: 5vmin;
  min-height: 5vmin;
  flex-grow: 1;
  border-radius: 0.5vmin;
  box-shadow: inset -0.5vmin -0.5vmin 0.5vmin rgba(255, 255, 255, 0.4), inset 0.5vmin 0.5vmin 0.5vmin rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1vmin;
  margin: 0.5vmin;
  position: relative;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}
.score-box.flash {
  animation: 0.5s flash-score-box;
}
@keyframes flash-score-box {
  from { background-color: #aae6ff; }
  to   { background-color: #289fd1; }
}
.tiles-score-box            { background-image: url('images/tile-value.svg'); }
.horizontal-bonus-score-box { background-image: url('images/horizontal-bonus.svg'); }
.vertical-bonus-score-box   { background-image: url('images/vertical-bonus.svg'); }
.all-colors-bonus-score-box { background-image: url('images/all-color-bonus.svg'); }

#total-score {
  background-color: #444;
  box-shadow: none;
  color: white;
  font-size: 5vmin;
  user-select: text;
  flex-grow: 0;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.5vmin;
  min-width: 7vmin;
}

#panel .value {
  position: absolute;
  top:   0;
  right: 0;
  padding-left:  0.3vmin;
  padding-right: 0.3vmin;
  border-bottom-left-radius: 0.8vmin;
  color: white;
  background-color: #444;
  font-size: 3.4vmin;
  font-weight: bold;
  user-select: text;
}
@media (orientation: portrait) {
  #panel {
    width: auto;
    padding-bottom: 1vmin;
  }
  #panel .scores {
    flex-direction: row;
    flex-grow: 1;
  }
}
@media (orientation: landscape) {
  #panel {
    padding-left: 1vmin;
  }
}
@media (max-width: 500px) {
  #panel .value {
    font-size: 5.5vmin;
  }
}
@media (max-aspect-ratio: 1/3) {
  #panel .scores {
    flex-direction: column;
  }
  #panel .bonuses {
    flex-direction: column !important;
    flex-grow: 3 !important;
  }
  #panel .value {
    font-size: 8vmin;
  }
}
