/* すべての要素で、widthやheightの計算にpaddingとborderを含める設定です */
* {
  box-sizing: border-box;
}

/* html要素全体の余白をなくし、高さを100%にします */
html {
  margin: 0;
  height: 100%;
}

/* body全体の見た目と中央寄せレイアウトを設定します */
body {
  margin: 0;
  height: 100vh;
  font-family: sans-serif;
  background: #f2f2f2;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* アプリ全体を囲む大きな枠です */
.container {
  margin: 0 auto;
  background: #ffffff;
  border: 2px solid #333;
  width: 100%;
  max-width: 1196px;
  height: 540px;
  display: flex;
  flex-direction: column;
}

/* ヘッダー部分の見た目を設定します */
.game-header {
  height: 50px;
  padding: 8px 12px;
  background: #ffffff;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e6e6e6;
}

/* ヘッダー内の情報エリアを横幅いっぱいに広げます */
.info {
  width: 100%;
}

/* 問題文とスコアを3列で並べるグリッドレイアウトです */
.quiz-header {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

/* 左側の空きスペースです */
.header-left {
  min-width: 1px;
}

/* 問題文の表示スタイルです */
.header-title {
  text-align: center;
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右上のスコア表示スタイルです */
.header-score {
  text-align: right;
  font-size: 18px;
  white-space: nowrap;
}

/* ゲームのメイン表示領域です */
.game-main {
  position: relative;
  background: #ffffff;
  flex: 1;
  overflow: hidden;
}

/* スタート画面とクイズ画面をメイン領域いっぱいに広げます */
.start-screen,
.quiz-screen {
  position: absolute;
  inset: 0;
}

/* スタート画面の中身を中央に配置します */
.start-screen {
  display: grid;
  place-items: center;
}

/* クイズ画面を左右2カラムで表示します */
.quiz-screen {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
  align-items: stretch;
}

/* 共通ボタンの見た目です */
.btn {
  padding: 12px 24px;
  font-size: 18px;
  border: 2px solid #333;
  background: #fff;
  cursor: pointer;
  border-radius: 12px;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

/* ボタンにマウスを乗せたときの色です */
.btn:hover {
  background: #d6f0ff;
}

/* ボタンを押した瞬間に少し縮めて押した感を出します */
.btn:active {
  transform: scale(0.98);
}

/* 選択肢カード全体の見た目です */
.choice-card {
  position: relative;
  border: 2px solid #333;
  border-radius: 18px;
  background: #fffdf8;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.2s ease, background-color 0.2s ease;
  touch-action: manipulation;
  overflow: hidden;
}

/* 選択肢カードにマウスを乗せたときの背景色です */
.choice-card:hover {
  background: #f5fbff;
}

/* 選択肢カードを押したときの縮小表現です */
.choice-card:active {
  transform: scale(0.985);
}

/* 回答後など、クリックできない状態にします */
.choice-card.is-disabled {
  pointer-events: none;
}

/* 不正解側を薄く見せるためのクラスです */
.choice-card.is-dim {
  opacity: 0.4;
}

/* 画像表示エリアです。背景画像として表示します */
.choice-image {
  width: 100%;
  flex: 1;
  min-height: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size:cover;
}

/* 選択肢の名前ラベルです。最初は非表示です */
.choice-label {
  min-height: 34px;
  font-size: 28px;
  font-weight: bold;
  color: #333;
  visibility: hidden;
  text-align: center;
}

/* 答え合わせ時にラベルを表示します */
.choice-label.is-visible {
  visibility: visible;
}

/* 正解マークの丸です */
.choice-mark {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 64px;
  height: 64px;
  border: 6px solid #ff3b30;
  border-radius: 50%;
  color: transparent;
  display: none;
  z-index: 2;
}

/* 正解マークを表示する状態です */
.choice-mark.is-visible {
  display: block;
}

/* 結果画面の全体スタイルです */
.result {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
}

/* 全問正解時の特別メッセージです */
.perfect-text {
  margin: 0;
  font-size: 28px;
  font-weight: bold;
  color: #ff6b00;
  display: none;
}

/* 通常の結果テキストです */
.result-text {
  margin: 0;
  font-size: 24px;
  font-weight: bold;
}

/* 画面幅が700px以下のときのスマホ向け調整です */
@media (max-width: 700px) {
  /* ヘッダーの列幅をスマホ向けに変更します */
  .quiz-header {
    grid-template-columns: 12px 1fr auto;
  }

  /* 問題文を少し小さくします */
  .header-title {
    font-size: 16px;
  }

  /* スコア文字も少し小さくします */
  .header-score {
    font-size: 14px;
  }

  /* クイズ画面の余白を縮めます */
  .quiz-screen {
    gap: 12px;
    padding: 12px;
  }

  /* カード内の余白を縮めます */
  .choice-card {
    padding: 10px;
  }

  /* ラベル文字を少し小さくします */
  .choice-label {
    font-size: 22px;
    min-height: 28px;
  }

  /* 正解マークを小さくします */
  .choice-mark {
    width: 48px;
    height: 48px;
    border-width: 5px;
  }

  /* 全問正解メッセージを少し小さくします */
  .perfect-text {
    font-size: 24px;
  }
}