body{
  background-color: #000;
  color: #fff;
}

header{
  display: flex;
  justify-content: center;
  margin-top: 10px;
  height: 200px;
  background-image: url('/img/logo.png');
  background-size: auto 100%;
  background-repeat: no-repeat;
  background-position: center;
}

body.griffin header{
  background-image: url('/img/logo-1.png');
}

body.unicorn header{
  background-image: url('/img/logo-2.png');
}

.background{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  grid-template-rows: 60px 1fr 60px;
  gap: 0;
  justify-content: center;
}

.background svg{
  width: 100%;
  height: 100%;
}

.background svg line{
  animation: line-glow 4s linear infinite;
}
.background svg line:nth-child(1){
  animation: line-glow 2s alternate infinite;
}

@keyframes line-glow{
  0%{
    opacity: 1;
  }
  20%{
    opacity: .9;
  }
  40%{
    opacity: .8;
  }
  60%{
    opacity: .9;
  }
  80%{
    opacity: .8;
  }
  100%{
    opacity: 1;
  }
}

.background svg.svg-logo{
  grid-column: 3;
}

.background svg.svg-mid.svg-left{
  grid-column: 1;
}

body.dragon .background svg line{
  stroke: #1e6b7a;
}
body.dragon .background svg line:nth-child(1){
  stroke: #2be3e3 !important;
}
body.griffin .background svg line{
  stroke: #1f5311;
}
body.griffin .background svg line:nth-child(1){
  stroke: #cce41a !important;
}
body.unicorn .background svg line{
  stroke: #270779;
}
body.unicorn .background svg line:nth-child(1){
  stroke: #e33a4b !important;
}

.background svg.svg-mid.svg-right{
  grid-column: 3;
}


#status-bar {
  position: relative;
  display: flex;
  justify-content: flex-start;
  font-size: 1.3rem;
  margin-bottom: 10px;
  font-family: "UnifrakturCook", cursive;
  font-weight: 700;
  font-style: normal;
  width: 540px;
  margin: 1em auto;
}

#bar-container{
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 30px;
  border-radius: 15px;
  border: 1px solid #fff;
  display: grid;
  grid-template-columns: 22.22% 33.33% 44.45%;
  gap: 0;
  overflow: hidden;
}

body.dragon #bar-container{
  border-color: #2be3e3;
  box-shadow: 0 0 0 4px #1e6b7aAA, 0 4px 24px #0008;
  animation: bar-glow0 3s ease-in-out infinite;
}

body.griffin #bar-container{
  border-color: #cce41a;
  box-shadow: 0 0 0 4px #1f5311AA, 0 4px 24px #0008;
  animation: bar-glow1 3s ease-in-out infinite;
}

body.unicorn #bar-container{
  border-color: #e33a4b;
  box-shadow: 0 0 0 4px #270779AA, 0 0 0 6px #fff460AA, 0 4px 24px #0008;
  animation: bar-glow2 3s ease-in-out infinite;
}
  

@keyframes bar-glow0{
  0%{
    box-shadow: 0 0 0 4px #1e6b7aAA, 0 4px 24px #0008;
  }
  50%{
    box-shadow: 0 0 0 3px #2be3e388, 0 0 0 6px #1e6b7aAA, 0 4px 24px #0008;
  }
  100%{
    box-shadow: 0 0 0 4px #1e6b7aAA, 0 4px 24px #0008;
  }
}

@keyframes bar-glow1{
  0%{
    box-shadow: 0 0 0 4px #1f5311AA, 0 4px 24px #0008;
  }
  50%{
    box-shadow: 0 0 0 6px #cce41a88, 0 0 0 3px #1f5311AA, 0 4px 24px #0008;
  }
  100%{
    box-shadow: 0 0 0 4px #1f5311AA, 0 4px 24px #0008;
  }
}

@keyframes bar-glow2{
  0%{
    box-shadow: 0 0 0 4px #270779AA, 0 0 0 6px #fff460AA, 0 4px 24px #0008;
  }
  50%{
    box-shadow: 0 0 0 8px #e33a4b88, 0 0 0 6px #270779AA, 0 0 3px 6px #fff460AA, 0 4px 24px #0008;
  }
  100%{
    box-shadow: 0 0 0 4px #270779AA, 0 0 0 6px #fff460AA, 0 4px 24px #0008;
  }
}
 
#score-label{
  position: absolute;
  width: 100px;
  padding-left: 5px;
  transition: padding-left 0.3s ease;
  text-shadow: 0 0 3px #000D;
}

body.dragon #score-label{
  color: #2be3e3;
}

body.griffin #score-label{
  color: #cce41a;
}

body.unicorn #score-label{
  color: #e33a4b;
}

#bar-container div{
  height: 100%;
  width: 0;
  transition: width 0.3s ease;
}

#bar-container #bar0{
  background: linear-gradient(to top, #1e6b7a, #2be3e3);
}
#bar-container #bar1{
  background: linear-gradient(to top, #1f5311, #cce41a);
}
#bar-container #bar2{
  background: linear-gradient(to top, #270779, #e33a4b);
}

#info-container{
  position: absolute;
  top: -30px;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 20px;
}

#info-container div{
  position: absolute;
  top: 0;
}
#info-container #info-0{
  left: calc(0% - 20px);
}
#info-container #info-1{
  left: calc(22.22% - 20px);
}
#info-container #info-2{
  left: calc(55.55% - 20px);
}

#info-container img{
  width: 40px;
  height: 40px;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(4, 120px);
  gap: 20px;
  justify-content: center;
  margin: 80px auto 40px;
  max-width: 600px;
}

body.dragon #game-board{
  grid-template-columns: repeat(4, 120px);
}

body.griffin #game-board{
  grid-template-columns: repeat(6, 120px);
}

body.unicorn #game-board{
  grid-template-columns: repeat(8, 120px);
}

.card {
  width: 120px;
  height: 180px;
  perspective: 1000px;
  cursor: pointer;
  position: relative;
}

.card-inner {
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(.4,2,.6,1);
  transform-style: preserve-3d;
  position: relative;
  border-radius: 18px;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  backface-visibility: hidden;
  box-shadow: 0 4px 24px #0008;
  overflow: hidden;
}

.card-back {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back:hover{
  transform: scale(1.05);
}

.card-back.dragon {
  border: 1px solid #2be3e3;
  box-shadow: 0 0 0 2px #1e6b7a, 0 4px 24px #0008;
  background: url('/img/carta-dragao.png') no-repeat center center;
  background-size: 100% 100%;
}
.card-back.griffin {
  border: 1px solid #cce41a;
  box-shadow: 0 0 0 2px #1f5311, 0 4px 24px #0008;
  background: url('/img/carta-grifo.png') no-repeat center center;
  background-size: 100% 100%;
}
.card-back.unicorn {
  border: 1px solid #270779;
  box-shadow: 0 0 0 2px #e33a4b, 0 4px 24px #0008;
  background: url('/img/carta-unicornio.png') no-repeat center center;
  background-size: 100% 100%;
}

.card-front {
  background: #fffaec;
  border: 2px solid #ffb347;
  box-shadow: 0 0 0 2px #ffcc33, 0 4px 24px #0008;
  transform: rotateY(180deg);
  transition: box-shadow 0.3s;
}

.card-front .card-frame {
    position: absolute;
    inset: 0;
    border: 4px double #ffcc33;
    border-radius: 18px;
    pointer-events: none;
}

.card-front .card-img {
    background-image: url('/img/tileset-mitos.png');
    background-size: 300% 400%; /* 3 colunas, 4 linhas */
    background-repeat: no-repeat;
    position: absolute;
    inset: 0;
    margin: 20% 0;
}

/* Classes para cada símbolo */
.card-front.dragon      .card-img { background-position:   0%   0%; }
.card-front.unicorn     .card-img { background-position:  50%   0%; }
.card-front.phoenix     .card-img { background-position: 100%   0%; }

.card-front.pegasus     .card-img { background-position:   0%  33%; }
.card-front.sagittarius .card-img { background-position:  50%  33%; }
.card-front.snakes      .card-img { background-position: 100%  33%; }

.card-front.octopus     .card-img { background-position:   0%  66%; }
.card-front.satyr       .card-img { background-position:  50%  66%; }
.card-front.cerberus    .card-img { background-position: 100%  66%; }

.card-front.werewolf    .card-img { background-position:   0% 100%; }
.card-front.griffin     .card-img { background-position:  50% 100%; }
.card-front.hydra       .card-img { background-position: 100% 100%; }

/* Efeito de par encontrado */
.card.matched .card-inner {
  animation: match-glow 1s ease;
}

@keyframes match-glow {
  0% { box-shadow: 0 0 0 0 #fff1; }
  33% { box-shadow: 0 0 5px 16px #fff8, 0 0 10px 16px #0008; }
  50% { box-shadow: 0 0 2px 26px #fff5, 0 0 10px 16px #0008;; }
  66% { box-shadow: 0 0 10px 16px #fff8, 0 0 10px 16px #0008;; }
  100% { box-shadow: 0 0 0 0 #fff1; }
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #222A;
  color: #fff;
  padding: 32px 24px 24px 24px;
  border-radius: 16px;
  box-shadow: 0 8px 32px #000a;
  text-align: center;
  min-width: 300px;
  position: relative;
  border: 4px solid var(--modal-color, #fff);
  transition: border-color 0.4s;
}

.modal-badge {
  width: 100px;
  height: 120px;
  margin-bottom: 12px;
  margin-top: -40px;
  filter: drop-shadow(0 0 12px var(--modal-color, #fff));
}

#modal-title {
  font-family: "UnifrakturCook", cursive;
  font-size: 2.5rem;
  color: var(--modal-color, #fff);
  margin-bottom: 8px;
  margin-top: 0;
  letter-spacing: 2px;
}

#modal-message {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

#modal-btn {
  margin-top: 12px;
  padding: 8px 32px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: none;
  background: var(--modal-color, #ffd700);
  color: #222;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.modal-close {
  position: absolute;
  right: 16px; top: 8px;
  font-size: 2rem;
  cursor: pointer;
  color: var(--modal-color, #fff);
}

#modal-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  margin-top: -80px;
}
#modal-badges img {
  width: 200px;
  height: 200px;
  filter: drop-shadow(0 0 12px var(--modal-color, #fff));
}

#modal-badges img.endgame {
    width: 100px;
    height: 100px;
}

@media (max-width: 1200px) or (max-height: 900px) {
    body.unicorn #game-board {
        grid-template-columns: repeat(8, 80px);
        gap: 20px;
    }

    body.unicorn .card {
        width: 80px;
        height: 120px;
    }
}

