* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  background: #f4f4f4;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #222;
}

.logo{
  width: 600px;
}

.saigomoji {
  font-size: 40px;
}

/* ===== 画面 ===== */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ===== フェード ===== */
.fade {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== スライド ===== */
.slide {
  animation: slideIn 0.4s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== タイトル ===== */
#titleScreen h1 {
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-size: 40px;
  margin-bottom: 24px;
}

/* ===== ボタン ===== */
button {
  padding: 12px 26px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  font-family: "M PLUS Rounded 1c", sans-serif;
}

/* ===== カード ===== */
.card {
  font-family: "M PLUS Rounded 1c", sans-serif;
  background: white;
  width: 90vw;
  max-width: 900px;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #ddd;
  text-align: center;
}

/* ===== 問題番号 ===== */
.question-number {
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-size: 18px;
  font-weight: bold;
  color: #666;
  margin-bottom: 12px;
}

/* ===== 画像 ===== */
.card img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 20px;
  cursor: pointer;
}

/* ===== 回答 ===== */
.answer-area {
  font-family: "M PLUS Rounded 1c", sans-serif;
  display: flex;
  gap: 10px;
}

input {
  font-family: "M PLUS Rounded 1c", sans-serif;
  flex: 1;
  padding: 14px;
  font-size: 18px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.rule{
  font-size: 30px;
}

.rule2{
  font-size: 50px;
}

#result {
  font-family: "M PLUS Rounded 1c", sans-serif;
  margin-top: 16px;
  font-size: 20px;
  font-weight: bold;
}

/* ===== 画像拡大 ===== */
#imageModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#imageModal img {
  max-width: 95vw;
  max-height: 95vh;
}

#finalScore {
  font-size: 32px;
  font-weight: bold;
  margin: 20px 0;
}


#scoreDisplay {
  font-size: 40px;
  color: #444;
  margin-bottom: 10px;
}

#rules-container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;   /* ←中央寄せ */
}


#ruleScreen {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}


#rules-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}


#rules-buttons button {
  display: inline-block !important;
  padding: 10px 18px;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
}

#rules-image {
  max-width: 100%;
  display: block;
  margin: 10px auto;
}



#hintModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#hintModal img {
  max-width: 95vw;
  max-height: 95vh;
}

.rule-slide {
  transform: translateX(0);
  opacity: 1;
}


/* ===== 正解・不正解アニメ ===== */
.correct {
  animation: correctAnim 0.4s ease;
  color: #2ecc71;
}

@keyframes correctAnim {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.wrong {
  animation: wrongAnim 0.4s ease;
  color: #e74c3c;
}

@keyframes wrongAnim {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-8px); }
  50%  { transform: translateX(8px); }
  75%  { transform: translateX(-8px); }
  100% { transform: translateX(0); }
}

/* 色が戻るときも滑らかに */
.card {
  transition: background-color 0.3s ease, border 0.3s ease;
}

/* 正解 */
.card.correct {
  font-family: "M PLUS Rounded 1c", sans-serif;
  border: 2px solid #2ecc71;
  background: #f0fff5;
}

/* 不正解 */
.card.wrong {
  font-family: "M PLUS Rounded 1c", sans-serif;
  border: 2px solid #e74c3c;
  background: #fff0f0;
}


/* ===== カード揺れ（不正解） ===== */
.shake {
  animation: shakeAnim 0.45s;
}

@keyframes shakeAnim {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-10px); }
  30%  { transform: translateX(10px); }
  45%  { transform: translateX(-8px); }
  60%  { transform: translateX(8px); }
  75%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

#rules-container {
  animation-duration: 0.3s;
  animation-fill-mode: both;abody {
  margin: 0;
  font-family: sans-serif;
}

/* 画面管理 */
.screen {
  display: none;
  width: 100vw;
  height: 100vh;
}

.screen.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 共通ボックス */
.box {
  text-align: center;
  max-width: 400px;
  width: 100%;
}

/* ルール画像 */
#ruleImage {
  max-width: 100%;
  display: none;
  margin: 10px auto;
}

/* ボタン */
.buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

/* スライドアニメ */
.rule-slide {
  animation: slideIn 0.4s ease;
}


@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

}

.screen {
  display: none;
}

.screen.active {
  display: flex; /* or block */
}


.slide-next {
  animation-name: slideNext;
}

.slide-prev {
  animation-name: slidePrev;
}

@keyframes slideNext {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slidePrev {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}



/* ===== スマホ ===== */
@media (max-width: 600px) {
  .card {
    width: 100vw;
    min-height: 100vh;
    border-radius: 0;
    border: none;
  }

  #titleScreen h1 {
    font-size: 32px;
  }

  input {
    font-size: 16px;
  }
}
