* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;

  background: #111;
  color: white;

  font-family: Arial, Helvetica, sans-serif;

  touch-action: manipulation;
  overscroll-behavior: none;
  overflow: hidden;
}

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

main {
  width: 100%;
  height: 100vh;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  /* ボタンを少し上へ */
  transform: translateY(-20px);
}

/* ゲーム画面 */

canvas {
  background: #000;
  border: 3px solid #555;

  image-rendering: pixelated;

  /* スマホ対応 */
  width: min(88vw, 288px);

  /* 縦長比率維持 */
  height: calc(min(88vw, 288px) * 2);
}

/* 操作ボタン */

.controls {
  margin-top: 10px;

  width: min(88vw, 288px);

  display: grid;
  grid-template-columns: repeat(4, 1fr);

  gap: 6px;
}

button {
  border: none;
  background: #333;
  color: white;

  padding: 12px 0;

  border-radius: 10px;

  font-size: 16px;
}

button:active {
  transform: scale(0.95);
  background: #555;
}

/* 小さいスマホ用 */

@media (max-height: 700px) {
  main {
    transform: translateY(-35px);
  }

  canvas {
    width: min(96vw, 340px);
    height: calc(min(80vw, 260px) * 2);
  }

  .controls {
    width: min(96vw, 340px);
  }

  button {
    padding: 10px 0;
    font-size: 14px;
  }
}

/* =========================
   3レーン落下ゲーム用
========================= */

.fall-game-wrap {
  position: relative;
}

#fallGame {
  background: #000;
  border: 3px solid #555;

  image-rendering: pixelated;

  width: min(88vw, 288px);
  height: calc(min(88vw, 288px) * 2);
}

#fallGameOverScreen {
  display: none;

  position: fixed;
  inset: 0;

  width: 100vw;
  height: 100vh;

  background: black;

  z-index: 9999;
}

#fallGameOverScreen.show {
  display: block;
}

#fallGameOverScreen img {
  width: 100%;
  height: 100%;

  object-fit: cover;
  display: block;
}

.fall-game-over-text {
  position: fixed;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  color: red;
  font-size: 48px;
  font-weight: bold;

  text-shadow:
    3px 3px 0 black,
    -3px -3px 0 black;
}

.fall-score-text {
  display: block;

  margin-top: 18px;

  font-size: 28px;
  color: white;

  text-align: center;
}

/* 拡大・スクロール系防止 */

html,
body {
  touch-action: manipulation;
  overscroll-behavior: none;

  overflow: hidden;

  -webkit-user-select: none;
  user-select: none;

  -webkit-touch-callout: none;
}

/* =========================
   検いけクイズ
========================= */

.kenike-quiz-page {
  width: 100%;
  min-height: 100vh;
  background: #111;
  color: white;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 16px;
}

.quiz-screen {
  display: none;
  width: min(92vw, 430px);
  text-align: center;
}

.quiz-screen.active {
  display: block;
}

.difficulty-buttons {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.difficulty-buttons button,
#backBtn,
 #rankingBtn{
  font-size: 22px;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: #333;
  color: white;
}

.difficulty-buttons button:active,
#backBtn:active,
#rankingBtn:active {
  transform: scale(0.96);
}

#introGif {
  width: min(88vw, 360px);
  max-height: 70vh;
  object-fit: contain;
}

.quiz-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}

.question-box {
  background: #222;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
}

#questionText {
  font-size: 22px;
  line-height: 1.4;
  margin: 12px 0 0;
}

#mediaBox img {
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  border-radius: 12px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-btn {
  min-height: 90px;
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 18px;
  font-weight: bold;
  padding: 12px;
}

.choice-btn:nth-child(1) {
  background: #e53935;
}

.choice-btn:nth-child(2) {
  background: #1e88e5;
}

.choice-btn:nth-child(3) {
  background: #fbc02d;
  color: #111;
}

.choice-btn:nth-child(4) {
  background: #43a047;
}

.choice-btn.correct {
  background: #00c853 !important;
  border: 4px solid #ffffff;
  color: white !important;

  transform: scale(1.03);
}

.choice-btn.wrong {
  background: #ff1744 !important;
  border: 4px solid #ffffff;
  color: white !important;

  transform: scale(0.97);
}

.choice-btn.fade {
  opacity: 0.35;
}
.choice-btn.disabled {
  pointer-events: none;
  opacity: 0.9;
}

#resultScreen {
  min-height: 80vh;
  background-image: url("images/result-bg.jpg");
  background-size: cover;
  background-position: center;
  border-radius: 20px;

  display: none;
  align-items: center;
  justify-content: center;
}

#resultScreen.active {
  display: flex;
}

.result-box {
  background: rgba(0, 0, 0, 0.72);
  padding: 28px;
  border-radius: 20px;
  width: 90%;
}

.result-box h1 {
  font-size: 42px;
  margin: 0 0 16px;
}

.result-box p {
  font-size: 26px;
  font-weight: bold;
}

#introVideo {
  width: min(88vw, 360px);
  max-height: 70vh;
  object-fit: contain;
}

/* =========================
   ハンバーガーメニュー
========================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;

  width: 100%;
  height: 64px;

  background: rgba(0, 0, 0, 0.92);

  display: flex;
  align-items: center;

  z-index: 5000;

  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.menu-button {
  width: 64px;
  height: 64px;

  border: none;
  background: transparent;

  color: white;
  font-size: 34px;

  cursor: pointer;

  touch-action: manipulation;
}

.site-title {
  color: white;
  font-size: 20px;
  letter-spacing: 2px;
}

.side-menu {
  position: fixed;
  top: 64px;
  left: 0;

  width: 220px;
  height: calc(100vh - 64px);

  background: rgba(0, 0, 0, 0.96);

  transform: translateX(-100%);
  transition: transform 0.25s ease;

  z-index: 4999;

  display: flex;
  flex-direction: column;

  padding-top: 20px;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu a {
  color: white;
  text-decoration: none;

  padding: 18px 22px;

  font-size: 18px;

  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.side-menu a:active {
  background: #333;
}

#my-rank {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;

  background: rgba(15, 15, 15, 0.95);
  border-top: 2px solid #00ff99;

  padding: 14px 12px;

  font-size: 18px;
  font-weight: bold;

  color: white;

  z-index: 9999;

  display: flex;
  justify-content: center;
  gap: 18px;

  flex-wrap: wrap;
}
.result-box button {
  display: block;
  width: 100%;
  margin-top: 14px;
}