@keyframes fadeOut-flex {
  0% {
    display: flex;
    opacity: 1;
  }

  99% {
    display: flex;
    opacity: 0;
  }

  100% {
    display: none;
    opacity: 0;
  }
}

@keyframes fadeIn-flex {
  0% {
    display: none;
    opacity: 0;
  }

  1% {
    display: flex;
    opacity: 0;
  }

  100% {
    display: flex;
    opacity: 1;
  }
}

@keyframes fadeIn-block {
  0% {
    display: none;
    opacity: 0;
  }

  1% {
    display: block;
    opacity: 0;
  }

  100% {
    display: block;
    opacity: 1;
  }
}

html,
body {
  font-family: 'Noto Sans JP', serif, 'ヒラギノ角ゴ Pro W3', 'メイリオ', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-weight: bold;
  touch-action: manipulation;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}

/* PC Only Screen */
.pc-only-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #9f753d;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  box-sizing: border-box;
}

.pc-only-screen__container {
  border-radius: 20px;
  padding: 60px 40px;
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.pc-only-screen__logo {
  width: 256px;
  margin: 0 auto 30px;
  border-radius: 20px;
  overflow: hidden;
}

.pc-only-screen__logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.pc-only-screen__title {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 32px;
  font-weight: bold;
  color: #f6e9d0;
  margin: 0 0 20px;
  letter-spacing: 0.5px;
}

.pc-only-screen__message {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: #f6e9d0;
  margin: 0 0 40px;
  line-height: 1.6;
}

.pc-only-screen__qr {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 30px;
  padding: 20px;
  background: #f8f8f8;
  border-radius: 12px;
  width: fit-content;
}

#qrCodeContainer {
  display: flex;
  align-items: center;
  justify-content: center;
}

#qrCodeContainer img {
  display: block;
  border-radius: 8px;
}

.pc-only-screen__url {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #f6e9d0;
  margin: 0;
  line-height: 1.8;
}

.pc-only-screen__url span {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 20px;
  background: #f0f0f0;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  color: #8b572a;
  word-break: break-all;
  max-width: 100%;
}

/* Responsive adjustments for PC screen */
@media (max-width: 768px) {
  .pc-only-screen__container {
    padding: 40px 24px;
  }

  .pc-only-screen__title {
    font-size: 24px;
  }

  .pc-only-screen__message {
    font-size: 16px;
  }

  .pc-only-screen__logo {
    width: 100px;
    height: 100px;
  }
}

/* Initial Guide */
#initialGuide {
  position: fixed;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 45%;
  height: auto;
  z-index: 101;
  opacity: 1;
  transition: opacity 0.5s;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
  pointer-events: none;
}

#initialGuide > img {
  width: 100%;
  height: auto;
  display: block;
}

/* Guide */
#guideButton {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translate(-50%);
  width: 256px;
  height: 256px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}

#guideButton > img,
#guideButton > canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#guideButton.guideButton__show {
  display: block;
  opacity: 1;
  animation: fadeIn-block 0.3s ease-in 0s forwards;
}

/* Guide layout animation and states */
#guide {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 700;
  /* 初期状態はcenterと同じにしておく */
  width: 90vw;
  max-width: 600px;
  min-width: 320px;
  height: auto;
  transform: translate(-50%, -50%) scale(1);
  transition:
    top 1s ease-in-out,
    transform 1s ease-in-out;
  will-change: transform;
  backface-visibility: hidden;
  pointer-events: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}

#guide.guide--center {
  width: 90vw;
  max-width: 600px;
  min-width: 320px;
  top: 50%;
  left: 50%;
  height: auto;
  transform: translate(-50%, -50%) scale(1);
}

#guide.guide--top {
  top: 40px;
  left: 50%;
  height: auto;
  transform: translate(-50%, 0) scale(0.5);
}

#guide .guide__inner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  gap: 0;
}

#guide .guide-item {
  position: relative;
  width: 33%;
  height: auto;
}

#guide .guide-item img {
  width: 100%;
  height: auto;
  display: block;
}

#guide .guide-slot,
#guide .guide-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

#guide .guide-overlay {
  opacity: 0;
}

/* guide overlay halo effect */
.guide-overlay--halo {
  animation: guide-halo-anim 1.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
  z-index: 11;
}

.guide-overlay--halo-end {
  animation: guide-halo-end-anim 1.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: forwards;
  filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
  z-index: 11;
}

@keyframes guide-halo-anim {
  0% {
    filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
  }
  40% {
    filter: drop-shadow(0 0 32px rgba(255, 255, 255, 0.8));
  }
  100% {
    filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
  }
}

@keyframes guide-halo-end-anim {
  0% {
    filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
  }
  40% {
    filter: drop-shadow(0 0 32px rgba(255, 255, 255, 0.8));
  }
  100% {
    filter: drop-shadow(0 0 32px rgba(255, 255, 255, 0.8));
  }
}

/* Game */
#game {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  display: flex;
  opacity: 1;
  align-items: center;
  justify-content: center;
  background-image: url('./assets/img/img_game_bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  padding: 110px 20px 50px;
  box-sizing: border-box;
  z-index: 99;
  transition: opacity 0.3s;
}

.game__inner {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 0;
}

.game__clear {
  background: rgba(0, 0, 0, 0.4);
  margin: 0;
  padding: 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* display: none; */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 10;
  transition: opacity 1s;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.game__clear-title {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60vw;
  max-width: 400px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.game__clear-footer {
  position: absolute;
  top: calc(50% + 120px);
  left: 50%;
  transform: translate(-50%, 0%);
  width: 80vw;
  max-width: 400px;
  height: auto;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.game__clear-text {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  margin: 0 auto;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
  font-size: 18px;
  color: #ffffff;
  text-align: center;
  line-height: 150%;
}

.game__clear-get-sticker {
  width: 80%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
  cursor: pointer;
  -webkit-user-select: auto;
  user-select: auto;
  pointer-events: auto;
}

.game__clear-title img,
.game__clear-get-sticker img {
  width: 100%;
  height: auto;
  display: block;
}

.game-bar-container {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 320px;
  height: 40px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-bar {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  height: auto;
  margin-top: 0;
  display: block;
  z-index: 1;
}

.game-mark {
  position: absolute;
  left: 0;
  top: 50%;
  width: 40px;
  height: 40px;
  transform: translateY(-50%);
  z-index: 2;
}

/* Camera */
#recorder {
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
  bottom: 8vh;
}

#recorder.recorder__show {
  display: block;
  opacity: 1;
  animation: fadeIn-block 0.3s ease-in 0s forwards;
}

#captureModeButton {
  position: absolute;
  bottom: 1vh;
  right: calc(50% - 100px);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
  width: 200px;
  justify-content: space-between;
  align-items: center;
  list-style: none;
}

#captureModeButton.cmb__show {
  display: flex;
  opacity: 1;
  animation: fadeIn-flex 0.3s ease-in 0s forwards;
}

#captureModeButton.cmb__disable {
  pointer-events: none;
}

#captureModeButton.cmb__disable > li {
  opacity: 0.3;
}

#captureModeButton > li {
  color: #fff;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
  font-size: 22px;
}
#captureModeButton > li.active {
  color: #8b572a;
  text-decoration: underline;
}

#myCanvas {
  position: absolute;
  max-width: 75%;
  max-height: 75%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0px 0px 0px 5px white;
  opacity: 0;
  transition: 0.5s;
}

/* Loading */
.absolute-fill {
  background-color: #8b572a !important;
}
.prompt-box-8w {
  background-color: white !important;
  color: #8b572a !important;
}
.prompt-button-8w {
  background-color: #e4c2b1 !important;
}

.button-primary-8w {
  background-color: #9f753d !important;
}

#requestingCameraPermissions {
  color: #8b572a !important;
  background-color: #fff !important;
}

#loadBackground {
  background-color: white !important;
}

#actionButton {
  background-color: #9f753d !important;
}
