.game-border {
  border: 15px ridge rgb(247, 212, 148);
  border-left-width: 8px;
  border-right-width: 8px;
  box-shadow: none !important;
  border-radius: 100%/10% !important;
}

body.l-1 {
  --primary-color: crimson;
  --secondary-color: purple;
  --card-bgcolor: #dc143c;
  --light-glow-shadow: rgba(243, 38, 79, 0.27);
  --expense-green: 122 39% 49%;
  --expense-green: 121 38% 79%;
}

body.l-2 {
  --card-bgcolor: purple;
  --primary-color: rgb(100, 0, 80);
  --secondary-color: rgb(80, 0, 60);
  --light-glow-shadow: rgba(151, 38, 243, 0.17);
}

body.l-3 {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.26)),
    url("https://img.freepik.com/premium-vector/cartoon-animation-scene-outdoor-scenery-game-wallpaper-background-illustration-design-banner_953932-7907.jpg");
    background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;

  --card-bgcolor: chocolate;
  --secondary-color: saddlebrown;
  --light-glow-shadow: rgba(151, 38, 243, 0.17);
  --secondary-color: #9e4c12;
}

body.power-up {
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.15),
    2px 4px 1px rgba(128, 0, 128, 0.777);

  background-image: radial-gradient(
    circle,
    rgba(0, 0, 0, 0) 30%,
    rgba(75, 0, 0, 0.56)
  );
}

#power-meter {
  display: flex;
  align-items: flex-end;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  height: 40px;
  background-color: rgb(228, 206, 167);
  border: 4px solid wheat;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.15),
    2px 4px 1px rgba(128, 0, 128, 0.777);
}

#power-meter > *:first-child {
  width: 10px;
  height: 50%;
  background-color: darkblue;
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  box-shadow: inset -1px -1px 3px rgba(0, 0, 0, 0.15);
  animation: none;
  transition: height, background-color 0.3s ease 100ms;
}

#power-meter[data-value="low"] > *:first-child {
  background-color: darkblue;
}

#power-meter[data-value="optimum"] > *:first-child {
  background-color: purple;
}

#power-meter[data-value="high"] > *:first-child {
  background-color: crimson;
}

#power-meter[data-value="max"] > *:first-child {
  background-color: rgb(255, 0, 76);
  /* animation: winGlow 800ms ease-in-out 5ms infinite alternate forwards; */
  animation: powerUpFlash 600ms linear 0s infinite alternate both;
}

#level-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  /* font-family: "Varela Round", sans-serif; */
  font-weight: 400;
  font-size: 20px;
  color: black;
  text-align: center;
  background-color: wheat;
  border-radius: 12px;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.35),
    inset -1px -1px 2px rgba(0, 0, 0, 0.15), 1px 4px 1px var(--secondary-color);
  min-height: 200px;
  width: 40%;
}

dialog {
  position: fixed;
  background-color: rgba(0, 0, 0, 0.05);
  width: 100%;
  height: 100%;
  top: 0;
  justify-content: center;
  align-items: center;
  border: none;
}

dialog[open] {
  display: flex;
}

dialog h3 {
  position: relative;
  font-size: 80px;
  font-weight: 700;
  text-transform: capitalize;
  color: rgb(253, 27, 72);
  text-align: center;
  z-index: 199;
  transform-origin: center;
  letter-spacing: 3px;
  -webkit-text-stroke: 3px rgb(255, 255, 255);
  text-stroke: 3px rgb(255, 255, 255);
  animation: winTextScale 790ms ease-in-out 0s 2 alternate forwards;
}

dialog h3::before {
  content: "You Won!";
  width: 100%;
  color: transparent;
  left: 0;
  top: 0;
  position: absolute;
  -webkit-text-stroke: 1px rgb(255, 255, 255);
  text-stroke: 1px rgb(255, 255, 255);
  transform-origin: center;
  /* transition: all 300ms ease-out; */
  animation: winGlow 800ms ease-in-out 5ms 1 normal forwards;
}

body > *:is(main, section) {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100vh;
  gap: 20px;
  padding: 24px;
  margin: auto;
  /* border: 3px solid green; */
}

section#main_menu {
  justify-content: center;
}

section#main_menu > * {
  min-width: 200px;
}

body > *:not(:target) {
  display: none;
}

main {
  position: relative;
}

main#play h1 {
  letter-spacing: 2px;
  text-align: center;
}

main header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

main #commentary > *.power-up,
header button.equipped-power-btn.max-power {
  background-image: linear-gradient(
    to left,
    #00ff00,
    #6666ff,
    #0099ff,
    #ff3399,
    #6666ff
  );
  background-size: 400% 100%;
}

main #commentary {
  /* display: none; */
  pointer-events: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

main #commentary > * {
  pointer-events: none;
  display: inline-block;
  --start-opacity: 0.7;
  text-transform: capitalize;
  white-space: nowrap;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  font-size: 50px;
  opacity: var(--start-opacity);
  text-shadow: 1px 1px 8px rgba(0, 0, 0, 0.45);
  /* animation: scaleAndFly 1000ms ease-in 100ms 1 normal both; */
}

main #commentary > *.power-up {
  --start-opacity: 0.9;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1px rgb(255, 255, 255);
  text-stroke: 1px rgb(255, 255, 255);
  color: transparent;
  font-size: min(16vw, 80px);
  letter-spacing: 1px;
  text-transform: capitalize;
  /* transform-origin: center; */
  animation: rainbow_animation 1.5s linear infinite,
    winTextScale 1000ms ease-in-out 0s 1 normal both;
  /* scaleAndFly 10000ms ease-in 0s 1 normal backwards; */
}

main header,
#card-box {
  max-width: 1075px;
}

main header button {
  position: relative;
  min-width: 50px;
  z-index: +99;
}

header button.equipped-power-btn.max-power {
  color: wheat;
  animation: rainbow_animation 1.5s linear infinite;
}

header button#peek-a-boo.max-power::after,
header button#blast-card.max-power::after {
  --glow-scale: 2.3;
  --glow-opacity: 0.6;
  content: "";
  z-index: -1;
  position: absolute;
  border-radius: 30%;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(192, 116, 255);
  opacity: 0.9;
  animation: glow 900ms ease 0s infinite normal backwards;
}

header #level-indicator {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header #level-indicator #level-count {
  padding: 0 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  background-color: var(--primary-color);
  border: 4px solid wheat;
  border-bottom-width: 16px;
  margin-bottom: -15px;
  border-radius: 12px;
  border-bottom-right-radius: 18px;
  border-bottom-left-radius: 18px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.15),
    2px 4px 1px var(--secondary-color);
}

header #level-indicator #level-name {
  display: flex;
  flex-direction: column;
  /* gap: 10px; */
  align-items: center;
  padding: 6px 30px 6px 12px;
  font-weight: 800;
  font-size: 20px;
  color: var(--secondary-color);
  background-color: wheat;
  border-radius: 12px;
  min-width: 200px;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.35),
    inset -1px -1px 2px rgba(0, 0, 0, 0.15), 1px 4px 1px var(--secondary-color);
}

header #level-indicator #power-meter {
  --height: 0.528rem;
  position: absolute;
  top: var(--height);
  left: calc(100% - 18px);
  height: calc(100% - var(--height));
  border-bottom-left-radius: 1px;
}

#card-box {
  display: grid;
  gap: 15px;
  width: 100%;
  padding: 10px;
  min-height: 350px;
  max-height: calc(100% - 70px);
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  /* border: 1px solid greenyellow; */
}

.card {
  cursor: pointer;
  background-image: var(--image);
  background-position: center;
  background-size: min(70px, 80%);
  background-repeat: no-repeat;
  background-color: white;
  position: relative;
  padding: 25px;
  min-width: 105px;
  min-height: 115px;
  max-height: 420px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.8;
  text-shadow: 1px 2px 2px rgba(0, 0, 0, 0.158);
  box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.25);
  transition-property: background-image, background-blend-mode;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

#card-box .card {
  --image: url("./assets/boy2.png");
  background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)),
    var(--image);
  background-position: center;
  background-size: cover, min(70px, 80%);
  background-repeat: no-repeat;
  background-blend-mode: normal, screen;
  background-color: var(--card-bgcolor);
  position: relative;
  border: none;
  box-shadow: inset 2px 2px 2px 2px var(--light-glow-shadow),
    inset -1px -4px 6px rgba(0, 0, 0, 0.25), 1px 2px 3px rgba(0, 0, 0, 0.25);
  transition-property: background-image, background-blend-mode;
  transition-duration: 0.3s;
  transition-timing-function: ease;
  pointer-events: initial;
}

#card-box .card.reveal {
  pointer-events: none;
  animation: rotateCard 900ms ease 0s 1 normal forwards,
    revealCard 600ms linear 0s 1 normal forwards;
}

#card-box .card.matched::after {
  content: "";
  z-index: +999;
  position: absolute;
  border-radius: 15px;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  opacity: 0.5;
  animation: glow 900ms ease 0s 1 normal forwards;
}

@media only screen and (max-width: 768px) {
  body > main {
    padding: 18px;
    gap: 18px;
  }

  header #level-indicator #level-name {
    width: auto;
    min-width: 150px;
    max-width: 300px;
    font-weight: 700;
    font-size: 18px;
  }

  #card-box {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(3, 1fr);
    overflow-y: auto;
  }

  #card-box .card {
    background-size: cover, min(50px, 80%);
    padding: 25px;
    min-width: 105px;
    min-height: 100px;
    max-height: 420px;
    border-radius: 15px;
  }

  #level-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    /* font-family: "Varela Round", sans-serif; */
    font-weight: 400;
    font-size: 20px;
    color: black;
    text-align: center;
    background-color: wheat;
    border-radius: 12px;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.35),
      inset -1px -1px 2px rgba(0, 0, 0, 0.15),
      1px 4px 1px var(--secondary-color);
    min-height: 200px;
    width: 85%;
  }
}
