:root {
  --main-color: #eb322f;
  --main-font: "WakuWaku", sans-serif;
}

@font-face {
  font-family: "WakuWaku";
  src: url("../fonts/mini-wakuwaku-maru.otf") format("opentype");
}

@font-face {
  font-family: "Cryaon";
  src: url("../fonts/cryaon.ttf") format("truetype");
}

.font-text {
  font-family: "Cryaon";
}

.bordered {
  position: relative;
}

.bordered::before {
  content: "";
  position: absolute;
  inset: 0px; /* expand outward so it sits like a border */
  background: url("../images/border.png") center / 100% 100% no-repeat;
  pointer-events: none;
  z-index: 2;
}

/* keep content above background but below border overlay */
.bordered > * {
  position: relative;
  z-index: 1;
}

* {
  margin: 0px;
  padding: 0px;
  font-family: var(--main-font);
  box-sizing: border-box;
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  background-image: url("../images/bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  width: 100%;
  min-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport: matches visible area on mobile */
  height: 100%;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  /* Safe area for notched devices (e.g. iPhone) */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.main-container {
  width: 100%;
  min-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport: matches visible area on mobile */
  height: 100%;
}

.landing-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport: matches visible area on mobile */
  height: 100%;
}

.landing-page .title-image {
  width: 130px;
  margin-bottom: 30px;
}

.landing-page .options {
  display: flex;
  gap: 20px;
  flex-direction: column;
  width: 100%;
  padding: 0px 45px;
}

.landing-page .options .btn {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 20px 25px;
  font-size: 28px;
  word-spacing: 3px;
}

.back-icon {
  width: 50px;
  position: absolute;
  left: 40px;
  top: 37px;
}

.me-container {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.me-container #page1 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 60px;
  width: 100%;
  padding: 0px 25px;
}

.me-container #page1 .hi-image {
  width: 120px;
  margin-bottom: 30px;
}

.textbox {
  width: 100%;
  background: white;
  border-radius: 20px;
  border: 4px solid #ffa600;
  padding: 30px;
  position: relative;
}

.textbox .title {
  background: #ffa600;
  padding: 5px 12px;
  position: absolute;
  top: -20px;
  border: 3px solid #fff;
  border-radius: 7px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  left: 27px;
  opacity: 0;
  transform: translateY(-100%);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.me-container .textbox .title.title-visible {
  opacity: 1;
  transform: translateY(0);
}

.textbox .subtext {
  color: #bcbcbc;
  margin-bottom: -10px;
  margin-top: 13px;
  font-size: 12px;
}

#page1 .press-anywhere {
  font-size: 16px;
  color: white;
  margin-top: 15px;
  text-align: center;
}

.me-container #page2 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 150px;
  width: 100%;
  padding: 0px 25px;
}

.me-container #page2 .heart-hold-image {
  width: 190px;
  margin-bottom: 30px;
}

#page2 .name-input {
  width: 100%;
  background: white;
  border-radius: 20px;
  font-size: 20px;
  border: none;
  padding: 15px;
  box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.13) inset;
  margin-bottom: 20px;
  margin-top: 20px;
  color: #000;
}

#page2 .name-input::placeholder {
  color: #acacac;
}

#page2 .btn {
  width: 100%;
  text-align: center;
  justify-content: center;
}

#page2 .name-input:focus {
  outline: none;
}

.me-container #page3,
.me-container #page4 {
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
  width: 100%;
  min-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport: matches visible area on mobile */
  height: 100%;
  gap: 30px;
}

.me-container #page3 .header,
.me-container #page4 .header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.me-container #page3 .header .title-image,
.me-container #page4 .header .title-image {
  width: 90px;
  margin-top: 30px;
}

.me-container #page3 .header p,
.me-container #page4 .header p {
  font-size: 25px;
  font-weight: 400;
  margin-top: 10px;
  color: white;
  text-align: center;
}

.me-container #page3 .body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.me-container #page3 .body .letter-sealed {
  width: 270px;
  margin-top: 30px;
  transition: opacity 1s ease;
}

.me-container.letter-transitioning #page4 {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.me-container.letter-transitioning #page4 #generated-letter {
  pointer-events: auto;
  transition: opacity 1s ease;
}

.me-container #page3 .body p {
  font-size: 30px;
  font-weight: 400;
  margin-top: 10px;
  color: white;
}

.me-container #page3 .corner-image,
.me-container #page4 .corner-image {
  width: 15vh;
  position: absolute;
  bottom: 0;
  right: 0;
}

.me-container #page4 .body .letter {
  width: 35vh;
  transition: opacity 1s ease;
}

#open-letter {
  width: 20vh;
  bottom: -30px;
  position: absolute;
  right: 50px;
}

.letter-animate {
  animation: letter-animate 0.8s ease-out forwards;
}

@keyframes letter-animate {
  0% {
    width: 270px;
    transform: translate(calc(-50vw + 50px + 10vh), calc(-40vh - 30px));
  }
  100% {
    width: 20vh;
    transform: none;
  }
}

.container {
  padding: 20px;
  max-width: 500px;
}

.btn {
  background-color: var(--main-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 3.4px solid white;
  border-radius: 32px;
  padding: 10px 15px;
  color: white;
  font-weight: 400;
  font-size: 24px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0px 4px 3.6px rgba(0, 0, 0, 0.14);
}

.btn.regen-button {
  justify-content: center;
}

.btn img {
  height: 25px;
}

.d-none {
  display: none !important;
}

.pc-container {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.pc-container .main-image {
  width: 420px;
}

.pc-container p {
  font-size: 24px;
  font-weight: 400;
  margin-top: 30px;
  color: white;
}

#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100%;
  min-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--main-color);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
  pointer-events: none;
}

#loading-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#loading-overlay img {
  width: 150px;
}

@media (min-width: 620px) {
  body {
    background-image: none;
    background-color: var(--main-color);
  }

  .main-container {
    display: none;
  }

  .pc-container {
    display: flex;
  }
}

.anin-img-cont {
  width: 180px;
  margin-bottom: 45px;
  transform: rotate(341deg);
}

.anin-img-cont-2 {
  width: 180px;
  margin-top: 45px;
  transform: rotate(-341deg);
}
