:root {
  --envelope-width: 150px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: sans-serif;
  background-image: url("./assets/bg-oriental.png");
  background-color: rgba(0, 0, 0, 0.5);
  background-blend-mode: darken;
}

.border {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 12px;
}

.border div {
  border-radius: 16px; /*1*/
  border: 4px solid transparent; /*2*/
  background: linear-gradient(45deg, #fbc926, #fffbcc) border-box; /*3*/
  mask: /*4*/ linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude; /*5*/
  width: 100%;
  height: 100%;
}

.wrapper {
  position: relative;
  filter: drop-shadow(1px 2px 8px rgba(0, 0, 0, 0.25));
}

.wrapper.wiggle {
  animation: wiggle 3s ease-in-out infinite;
}

.front {
  position: absolute;
  width: var(--envelope-width);
  height: calc(1.5 * var(--envelope-width));
  top: 0;
  left: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -ms-backface-visibility: hidden;
}

.envelope {
  position: relative;
  width: var(--envelope-width);
  height: calc(1.5 * var(--envelope-width));
  border-radius: 24px;
  background-image: linear-gradient(to bottom right, #126b2e, #01170a);
  z-index: 0;
}

.back {
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
  z-index: 2;
  filter: drop-shadow(0px -20px 10px rgba(0, 0, 0, 0.25));
}

.flap-front,
.flap-back {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 3;
  transform-origin: top;
}

.flap-front {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -ms-backface-visibility: hidden;
}

.card {
  position: absolute;
  width: 85%;
  z-index: 1;
}

.code {
  position: absolute;
  z-index: 2;
  background-color: white;
  padding: 12px 24px;
  border-radius: 12px;
  width: fit-content;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
}

.code-content {
  display: flex;
  gap: 64px;
}

.code-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-text-header {
  font-weight: 700;
  font-size: 12px;
}

.code-text-value {
  font-weight: 500;
  font-size: 16px;
}

.code-footer {
  color: #64748b;
  font-size: 10px;
}

#load-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#loader {
  height: 4.5px;
  width: 130px;
  background: linear-gradient(#006234 0 0), linear-gradient(#006234 0 0),
    #dbdcef;
  background-size: 60% 100%;
  background-repeat: no-repeat;
  animation: progress-7x9cg2 3s infinite;
}

#error {
  font-size: 32px;
  font-weight: 700;
  color: white;
}

@media screen and (min-width: 768px) {
  :root {
    --envelope-width: 250px;
  }

  .border {
    padding: 16px;
  }

  .code-text-header {
    font-size: 14px;
  }

  .code-text-value {
    font-size: 20px;
  }

  .code-footer {
    font-size: 12px;
  }

  #loader {
    width: 300px;
  }
}

@media screen and (min-width: 1024px) {
  :root {
    --envelope-width: 320px;
  }
}

@keyframes progress-7x9cg2 {
  0% {
    background-position: -150% 0, -150% 0;
  }

  66% {
    background-position: 250% 0, -150% 0;
  }

  100% {
    background-position: 250% 0, 250% 0;
  }
}

@keyframes wiggle {
  0%,
  80%,
  100% {
    transform: rotate(0deg);
  }
  83%,
  89%,
  97% {
    transform: rotate(2deg);
  }
  86%,
  93% {
    transform: rotate(-2deg);
  }
}
