/*すべてのページに適応される設定*/
* {
  font-size: 18px;
  font-family: "Kaisei Decol", serif;
  font-weight: 400;
  font-style: normal;
  line-height: 1.8;
}

/* htmlとbodyの背景色を黒に設定（reset.cssの白を上書き） */
html {
  background-color: #000000;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
}

.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;

  background: radial-gradient(#a282c085 3px, transparent 4px),
    radial-gradient(#a282c085 3px, #21101000 4px),
    linear-gradient(#000000 4px, transparent 0),
    linear-gradient(
      45deg,
      transparent 74px,
      transparent 75px,
      #a282c085 75px,
      #e0bfff85 76px,
      transparent 77px,
      transparent 109px
    ),
    linear-gradient(
      -45deg,
      transparent 75px,
      transparent 76px,
      #e0bfff85 76px,
      #e0bfff85 77px,
      transparent 78px,
      transparent 109px
    ),
    #000000;
  background-size: 109px 109px, 109px 109px, 100% 6px, 109px 109px, 109px 109px;
  background-position: 54px 55px, 0px 0px, 0px 0px, 0px 0px, 0px 0px;
}

main {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  width: 95%;
  position: relative;
  z-index: 10;
}

/********** タイトル画像 **********/
.title {
  text-align: center;
  padding-top: 1em;
  opacity: 0;
  animation: fadeInTitle 0.8s ease-out forwards;
  animation-delay: 2.5s;
}

.title img {
  width: 100%;
  height: auto;
}

@keyframes fadeInTitle {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/********** top推し系統画像 **********/
.menimg-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  margin: 1em 0 2em;
}

.menimg-container img {
  width: 50%;
  height: auto;
  opacity: 0;
}

.menimg-container img:nth-child(1) {
  -webkit-animation: example 0.5s ease 3s 1 forwards;
  animation: example 0.5s ease 3s 1 forwards;
}
.menimg-container img:nth-child(2) {
  -webkit-animation: example 0.8s ease 3.5s 1 forwards;
  animation: example 0.8s ease 3.5s 1 forwards;
}

@-webkit-keyframes example {
  100% {
    opacity: 1;
  }
}
@keyframes example {
  100% {
    opacity: 1;
  }
}

/********** ボタンテキスト **********/
.button-text {
  font-weight: bold;
  color: #ffffff;
  margin-top: 0.5em;
  padding-bottom: 0.5em;
  opacity: 0;
  animation: fadeInButtonText 0.8s ease-out forwards;
  animation-delay: 4s;
}

@keyframes fadeInButtonText {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/********** ボタン **********/
/* From Uiverse.io by cssbuttons-io */
button {
  --glow-color: rgb(217, 176, 255);
  --glow-spread-color: rgba(191, 123, 255, 0.781);
  --enhanced-glow-color: rgb(231, 206, 255);
  --btn-color: rgb(100, 61, 136);
  border: 0.25em solid var(--glow-color);
  padding: 1em 3em;
  color: var(--glow-color);
  font-weight: bold;
  background-color: var(--btn-color);
  border-radius: 1em;
  outline: none;
  box-shadow: 0 0 1em 0.25em var(--glow-color),
    0 0 4em 1em var(--glow-spread-color),
    inset 0 0 0.75em 0.25em var(--glow-color);
  text-shadow: 0 0 0.5em var(--glow-color);
  position: relative;
  transition: all 0.3s;
  margin: 0.5em 0;
  opacity: 0;
  animation: fadeInButton 0.8s ease-out forwards;
}

@keyframes fadeInButton {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* フェードイン後、dokidokiアニメーションを開始 */
#startBtn:not(.hide) {
  animation: fadeInButton 0.8s ease-out forwards, dokidoki 1.5s infinite;
  animation-delay: 4.3s, 5.1s;
}

@keyframes dokidoki {
  0% {
    transform: scale(1.05);
  }
  5% {
    transform: scale(1);
  }
  95% {
    transform: scale(1);
  }
  100% {
    -webkit-transform: scale(1.05);
  }
}

button::after {
  pointer-events: none;
  content: "";
  position: absolute;
  top: 120%;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: var(--glow-spread-color);
  filter: blur(2em);
  opacity: 0.7;
  transform: perspective(1.5em) rotateX(35deg) scale(1, 0.6);
}

button:hover {
  color: var(--btn-color);
  background-color: var(--glow-color);
  box-shadow: 0 0 1em 0.25em var(--glow-color),
    0 0 4em 2em var(--glow-spread-color),
    inset 0 0 0.75em 0.25em var(--glow-color);
}

button:active {
  box-shadow: 0 0 0.6em 0.25em var(--glow-color),
    0 0 2.5em 2em var(--glow-spread-color),
    inset 0 0 0.5em 0.25em var(--glow-color);
}

/********** ボタンシャッフル **********/
.btnshuffle {
  --green: #1bfd9c;
  padding: 0.7em 2.7em;
  letter-spacing: 0.06em;
  position: relative;
  border-radius: 0.6em;
  overflow: hidden;
  transition: all 0.3s;
  line-height: 1.4em;
  border: 2px solid var(--green);
  background: linear-gradient(
    to right,
    rgba(27, 253, 156, 0.1) 1%,
    transparent 40%,
    transparent 60%,
    rgba(27, 253, 156, 0.1) 100%
  );
  color: var(--green);
  box-shadow: inset 0 0 10px rgba(27, 253, 156, 0.4),
    0 0 9px 3px rgba(27, 253, 156, 0.1);
  margin: 2em 0;
}

.btnshuffle:hover {
  color: #82ffc9;
  box-shadow: inset 0 0 10px rgba(27, 253, 156, 0.6),
    0 0 9px 3px rgba(27, 253, 156, 0.2);
}

.btnshuffle:before {
  content: "";
  position: absolute;
  left: -4em;
  width: 4em;
  height: 100%;
  top: 0;
  transition: transform 0.4s ease-in-out;
  background: linear-gradient(
    to right,
    transparent 1%,
    rgba(27, 253, 156, 0.1) 40%,
    rgba(27, 253, 156, 0.1) 60%,
    transparent 100%
  );
}

.btnshuffle:hover:before {
  transform: translateX(15em);
}

.hide {
  display: none;
}

/********** 説明 **********/
.description {
  color: #ffffff;
  margin-top: 4em;
  padding-bottom: 3em;
  opacity: 0;
  animation: fadeInDescription 0.8s ease-out forwards;
  animation-delay: 4.8s;
}

@keyframes fadeInDescription {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.description h1 {
  font-size: 1.3em;
  font-weight: bold;
  margin-bottom: 0.5em;
}

/* --- シャッフル中のカード --- */
.shuffle-area {
  position: relative;
  width: 100%;
  height: 240px;
  margin: 2em 0 3em;
  overflow: hidden;
}

.shuffle-card {
  position: absolute;
  width: 120px;
  height: 180px;
  background: #333;
  border: 2px solid #777;
  border-radius: 10px;
  background-image: url("/img/favorite/card.png");
  background-size: cover;
  animation: spin 0.6s linear infinite;
}

.shuffle-card.stop {
  animation: none;
}

@keyframes spin {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

/* --- 15枚の列 --- */
.card-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-bottom: 40px;
  min-height: 240px;
  position: relative;
  margin-top: 20px;
}

.card-row.hide {
  min-height: 0;
  padding-bottom: 0;
  margin-top: 0;
  display: none;
}

.card-row > p {
  width: 100%;
  margin-bottom: 10px;
  text-align: center;
}

.card-row > .card {
  flex: 0 0 auto;
}

.card-row .card-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.card {
  width: 110px;
  height: 160px;
  background: #333;
  border: 2px solid #777;
  border-radius: 10px;
  background-image: url("/img/favorite/card.png");
  background-size: cover;
  background-position: center;
  transition: 0.3s;
  cursor: pointer;
}

.card:hover {
  filter: brightness(1.5);
}

/* タップ時振動 */
@keyframes shake {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(2px, -2px) rotate(1deg);
  }
  50% {
    transform: translate(-2px, 2px) rotate(-1deg);
  }
  75% {
    transform: translate(2px, 2px) rotate(0.5deg);
  }
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

/* --- 結果カード --- */
.result-area {
  margin-top: 20px;
  min-height: 240px;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.result-area.hide {
  min-height: 0;
  margin-top: 0;
  display: none !important;
}

.result-text {
  font-size: 1.3em;
  font-weight: bold;
  margin: 1em 0;
  color: #fff;
}

.result-card {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 14px;
  width: 100%;
  max-width: 300px;
  min-height: 400px;
  opacity: 0;
}

.result-card.fade-in {
  animation: fadeIn 1.5s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.result-card img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.result-card img.loaded {
  opacity: 1;
}

#retryBtn {
  margin-top: 3em;
}

.result-card::after {
  content: "";
  display: block;
  width: 30px;
  height: 100%;
  position: absolute;
  top: -180px;
  left: 0;
  background-color: #fff;
  opacity: 0;
  transform: rotate(45deg);
  animation: reflect 2s ease-in-out infinite;
  -webkit-transform: rotate(45deg);
  -webkit-animation: reflect 2s ease-in-out infinite;
}
@keyframes reflect {
  0% {
    transform: scale(0) rotate(45deg);
    opacity: 0;
  }
  80% {
    transform: scale(0) rotate(45deg);
    opacity: 0.5;
  }
  81% {
    transform: scale(4) rotate(45deg);
    opacity: 1;
  }
  100% {
    transform: scale(50) rotate(45deg);
    opacity: 0;
  }
}
@-webkit-keyframes reflect {
  0% {
    transform: scale(0) rotate(45deg);
    opacity: 0;
  }
  80% {
    transform: scale(0) rotate(45deg);
    opacity: 0.5;
  }
  81% {
    transform: scale(4) rotate(45deg);
    opacity: 1;
  }
  100% {
    transform: scale(50) rotate(45deg);
    opacity: 0;
  }
}

.share-box {
  width: 90%;
  max-width: 500px;
  margin: 3em auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#shareText {
  width: 100%;
  height: 170px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid;
  background: #f1f1f1;
  color: #161616;
}

#shareBtn {
  padding: 12px;
  background: #1c1c1d;
  color: #fff;
  border: 2px solid #6cbbff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: 0.2s;
  width: 60%;
  margin: 0 auto;
}

#shareBtn:hover {
  opacity: 0.8;
}

/********** ロード画面 **********/
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(9, 9, 16);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeOut 0.5s ease-out 2s forwards;
}

.loader-content {
  text-align: center;
  animation: fadeInScale 1s ease-out;
}

.loader-image {
  width: 80%;
  max-width: 400px;
  height: auto;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

/********** フッター **********/
#footer {
  text-align: center;
  margin-top: 3em;
  color: #fff;
}
