html {
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}

header {
      /* background-color: #ffffff;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
      padding: 10px 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      /* position: sticky; */
      top: 0;
      z-index: 1000;
    }

    .logo {
      height: 50px;
    }
body {
  margin: 0;
  padding: 20px;
  font-family: sans-serif;
  background-image: url('../images/top-page/background.PNG');
  background-size: cover;
    background-repeat: no-repeat;
  background-color: #fefefe;
  overflow: auto;
}

.title-image img {
  max-width: 80%;
  height: auto;
  display: block;
  margin: 20px auto;
}


.profile-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.profile-image-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-img {
  width: 150px;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0,0,0,0.1);
}

.profile-name {
  margin-top: 10px;
  font-size: 1em;
  font-weight: bold;
  text-align: center;
  color: #333;
}

.profile-name span {
  font-size: 0.9em;
  color: #666;
}

.profile-name {
  margin-top: 8px;
  font-weight: bold;
  font-size: 1em;
  color: #444;
}

.topics {
  margin: 40px auto;
  max-width: 600px;
  background-color: #eaf7ff;
  border-left: 6px solid #17a2b8;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  text-align: left;
}

.topics h2 {
  font-size: 1.4em;
  margin-bottom: 10px;
  color: #0d6efd;
}

.topics-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.topics-list li {
  margin-bottom: 10px;
  font-size: 0.95em;
  line-height: 1.6;
  padding-bottom: 8px;
  border-bottom: 1px dotted #999;
}



.flashcard {
  width: 300px;
  height: 200px;
  margin: 30px auto;
  perspective: 1000px;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard.flip .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  background: white;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-size: 1.2rem;
}

.flashcard-back {
  transform: rotateY(180deg);
  background-color: #f8f8f8;
  color: #333;
}

.card {
  width: 100%;
  max-width: 500px;
  margin: 20px auto;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  background-color: #fff;
  box-sizing: border-box;
  position: relative;
  perspective: 1000px;
  height: 400px; /* 必要に応じて固定高さも */
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  font-size: 20px;
  padding: 1em;
  backface-visibility: hidden;
  border: 1px solid #ccc;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background-color: white;
  transition: transform 0.6s;
}

.card .front, .card .back {
  text-align: center;
  width: 100%;
  height: 100%;
  position: absolute;
  font-size: 20px;
  padding: 1em;
  backface-visibility: hidden;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: transform 0.6s;
}

.card .back {
  transform: rotateY(180deg);
}

.card.flipped .front {
  transform: rotateY(180deg);
  transition: transform 0.3s;
}

.card.flipped .back {
  transform: rotateY(0);
  transition: transform 0.3s;
}

.flashcard-image {
  max-width: 80%;
  height: auto;
  border-radius: 8px;
  display: block;
  /* margin: 15px auto 0 auto; */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#card-front {
  /* padding: 10px; */
  min-height: 200px; /* 最低限の高さを確保 */
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* gap: 15px; */
}

/* #flashcard-container {
  width: 100%;
  display: flex;
  justify-content: center;
} */

#flashcard {
  display: block; /* ← flexをやめて、内容の自然な流れを尊重 */
  /* padding: 20px; */
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  max-width: 600px;
  margin: 0 auto;
  box-sizing: border-box;
  text-align: center;
}

.howto {
  font-size: 1em;
  color: #333;
  text-align: center;
  margin-bottom: 10px;
  background-color: #ffffe0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 20px; /* ボタン間の余白 */
  margin-top: 20px;
}

.nav-buttons .btn {
  flex: 1;
  max-width: 180px;
}


#next-btn {
  display: block;
  margin: 30px auto 0 auto;
  padding: 10px 20px;
  font-size: 16px;
  position: static;
  bottom: 20px;
  left: 50%;
  transform: none;
  z-index: 999;
}

 #prev-btn {
  display: block;
  margin: 30px auto 0 auto;
  padding: 10px 20px;
  font-size: 16px;
  position: static;
  /* bottom: 20px;
  left: 50%; */
  transform: none;
  z-index: 999;
} 

#home-btn {
  display: block;
  margin: 10px auto;
  padding: 8px 16px;
  font-size: 14px;
  text-align: center;
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s;
}

#home-btn:hover {
  background-color: #e0e0e0;
}

.container {
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
  padding: 20px;
}

.subject-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 30px;
}

.subject-buttons img{
    width: 100%;
}
/* .btn {
  display: inline-block;
  padding: 15px 30px;
  background-color: #4678f0;
  color: white;
  border-radius: 10px;
  text-decoration: none;
  font-size: 1.2rem;
  transition: background-color 0.3s;
} */

.btn:hover {
  background-color: #2c5ec0;
}

.back-btn {
  display: block;
  width: fit-content;
  margin: 20px auto 10px auto;
  padding: 10px 20px;
  font-size: 16px;
  background-color: #ddd;
  color: #333;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  transition: background-color 0.3s;
}
.back-btn:hover {
  background-color: #bbb;
}

.start-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 30px;
  font-size: 20px;
  border: none;
  border-radius: 10px;
  background-color: #007BFF;
  color: white;
  text-decoration: none;
  transition: background-color 0.3s;
  z-index: 1000;
}

.start-btn:hover {
  background-color: #0056b3;
}

.site-footer {
  background-color: #222;
  color: #fff;
  text-align: center;
  padding: 20px 10px;
  font-size: 0.9rem;
  margin-top: 40px;
}

.site-footer a {
  color: #9ecfff;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

#card-counter {
  margin: 10px auto;
  font-size: 1rem;
  color: #555;
}




@media (max-width: 600px) {
  .flashcard-front,
  .flashcard-back {
    font-size: 1rem;
    padding: 15px;
  }
  

  .title-image img {
  max-width: 100%;
  
}

.start-btn{
    width: 90%;
}
  #next-btn {
    font-size: 14px;
    padding: 8px 16px;
  }

#prev-btn {
    font-size: 14px;
    padding: 8px 16px;
  }

  .card {
    padding: 15px;
  }
}
#flashcard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 80vh;
  padding: 20px;
  box-sizing: border-box;
}

#flashcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 600px;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

.card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2; /* or fixed height */
  perspective: 1000px;
}

.card .front, .card .back {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 1em;
  backface-visibility: hidden;
  border-radius: 12px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card .front {
  background-color: white;
  transform: rotateY(0deg);
}

.card .back {
  background-color: #f8f8f8;
  transform: rotateY(180deg);
}

.card.flipped .front {
  transform: rotateY(180deg);
}

.card.flipped .back {
  transform: rotateY(360deg);
}
