/* ===== 土台 ===== */
html,
body {
  height: 100%;
  margin: 0;
  background-color: #000;
}

#tour {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 0;
}

/* ===== 画面幅ごとのスケール（計算済みの値） ===== */
:root {
  --scale: 1;
  /* 全体用 */
  --scale-bubble: 1;
  /* セリフ用（#bubble, .inline-btn）*/
  --scale-narrator: 1;
  /* ナレーター用（#narrator）*/
}

/* ～390px */
@media (max-width: 389px) {
  :root {
    --scale: 0.9;
    --scale-bubble: 0.8;
    --scale-narrator: 0.9;
  }
}

/* 390px */
@media (min-width: 390px) {
  :root {
    --scale: 1;
    --scale-bubble: 1.1;
    --scale-narrator: 1;
  }
}

/* 768px */
@media (min-width: 768px) {
  :root {
    --scale: 1.25;
    --scale-bubble: 1.2;
    --scale-narrator: 1.25;
  }
}

/* 1280px */
@media (min-width: 1280px) {
  :root {
    --scale: 1.3;
    --scale-bubble: 1.3;
    --scale-narrator: 1.3;
  }
}

/* 1536px */
@media (min-width: 1536px) {
  :root {
    --scale: 1.4;
    --scale-bubble: 1.45;
    --scale-narrator: 1.4;
  }
}

/* 1920px～ */
@media (min-width: 1920px) {
  :root {
    --scale: 1.5;
    --scale-bubble: 1.5;
    --scale-narrator: 1.5;
  }
}

/* 2560px～ */
@media (min-width: 2560px) {
  :root {
    --scale: 1.7;
    --scale-bubble: 1.7;
    --scale-narrator: 1.7;
  }
}

/* ローディング */
#loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1000px 600px at 70% 30%, rgba(255, 255, 255, .06), transparent 60%),
    radial-gradient(900px 600px at 20% 70%, rgba(255, 255, 255, .05), transparent 60%),
    rgba(10, 20, 12, 0.85);
  backdrop-filter: blur(2px);
  z-index: 9999;
  color: #fff;
  transition: opacity .6s ease;
}

#loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-inner {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
  padding: 16px 20px;
}

.school {
  font-weight: 700;
  letter-spacing: .18em;
  font-size: clamp(14px, 2.3vw, 16px);
  color: #e8fff0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

#motto {
  margin: 0;
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 800;
  letter-spacing: .18em;
  line-height: 1.4;
}

#motto .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(.35em);
  animation: rise .6s ease forwards;
  animation-delay: calc(var(--i) * .07s);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.progress {
  position: relative;
  width: min(70vw, 420px);
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), 0 4px 14px rgba(0, 0, 0, .18);
  margin-top: 10px;
}

.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #88ffb0, #46d07a 60%, #2aa15a);
  border-radius: 999px 0 0 999px;
  transition: width 60ms linear;
}

.percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, .95);
  letter-spacing: .08em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

/* ===== ナレーター（右下） ===== */
#narrator {
  position: fixed;
  right: 0px;
  bottom: 0;
  width: calc(180px * var(--scale-narrator));
  /* 個別スケール */
  max-height: 100vh;
  object-fit: contain;
  z-index: 12;
  pointer-events: none;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .35));
}

/* ===== セリフ帯 ===== */
#speech {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  padding: calc(1px * var(--scale));
  /* 全体スケール */
  text-align: center;
  z-index: 13;
  pointer-events: none;
  /* ← これでセリフ帯自体は“触れない” */
}

/* ただし、セリフ内のボタンは操作可能に戻す */
#speech .inline-btn,
#speech .choice-btn {
  pointer-events: auto;
  /* ← ボタンだけクリック/タップ可 */
}

/* 選択肢ボタン群 */
.choice-group {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  z-index: 14;
}

.choice-btn {
  padding: calc(8px * var(--scale-bubble, 1)) calc(14px * var(--scale-bubble, 1));
  border: 3px solid rgba(255, 255, 255, 0.7);
  /* ← 細い白グレーの縁 */
  border-radius: 9999px;
  font-size: calc(15px * var(--scale-bubble, 1));
  font-weight: 600;
  cursor: pointer;
  background: rgb(255, 36, 70);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  z-index: 14;
}

.choice-btn:active {
  transform: translateY(1px);
}


/* ===== 吹き出し ===== */
#bubble {
  display: inline-block;
  background: rgba(255, 255, 255, .92);
  color: #222;
  border-radius: 14px;
  padding: calc(14px * var(--scale-bubble)) calc(16px * var(--scale-bubble));
  line-height: 1.8;
  font-family: "Yu Gothic", "Segoe UI", sans-serif;
  font-size: calc(16px * var(--scale-bubble));
  /* 個別スケール */
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  max-width: min(90vw, calc(960px * var(--scale-bubble)));
  /* 個別スケール */
  word-wrap: break-word;
  margin: 0 auto;
}

/* タイプ文字の改行維持 */
#typed {
  white-space: pre-wrap;
}

/* ===== インラインボタン ===== */
.inline-btn {
  display: inline-block;
  margin-left: .5em;
  padding: calc(8px * var(--scale-bubble)) calc(14px * var(--scale-bubble));
  border: 3px solid rgba(255, 255, 255, 0.7);
  /* ← 細い白グレーの縁 */
  border-radius: 9999px;
  font-size: calc(15px * var(--scale-bubble));
  font-weight: 600;
  cursor: pointer;
  background: rgb(255, 36, 70);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.inline-btn:active {
  transform: translateY(1px);
}

/* ===== 最終ページ用 ===== */
.vr-floating-btn {
  display: inline-block;
  margin-top: calc(16px * var(--scale-bubble));
  /* bubbleとの距離 */

  background: rgb(95, 218, 193);
  color: #fff;
  padding: calc(12px * var(--scale-bubble)) calc(24px * var(--scale-bubble));
  border-radius: 30px;
  text-decoration: none;

  font-size: calc(16px * var(--scale-bubble));
  font-weight: bold;

  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);

  transition: background 0.2s ease;
}

/* 色変化（ホバー） */
.vr-floating-btn:hover {
  background: rgb(75, 198, 173);
}

/*　ここからポップアップ　*/
/* ===== オーバーレイ（iframe より上） ===== */
.overlay {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  /* 最初は非表示 */
  justify-content: center;
  align-items: center;
  z-index: 20;
  /* iframeより上に表示 */
  background: rgba(0, 0, 0, 0.3);
  /* 背景を透明にした状態で半透明の黒に */
}

/* 背景画像レイヤー */
.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('popupbk.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(2px);
  opacity: 0.85;
}

#popupBox {
  position: relative;
  /* ボタンを内部で絶対配置するために必要 */
  color: #fff;
  /* 文字色を白に */
  font-family: "Meiryo", "ヒラギノ角ゴシック W3", "MS PGothic", sans-serif;
  /* 明朝体に */
  overflow: auto;
  /* はみ出した場合にスクロール */
  background: rgba(70, 180, 110, 0.7);
  /* ここは背景を白に */
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  line-height: 1.5;
  animation: fadeIn .25s ease-out;
  z-index: 1;
  /* popupBoxがoverlayより上に表示される */
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

#popupTitle {
  font-size: 18px;
  text-shadow: 1px 1px 3px #000;
}

#popupText {
  font-size: 13px;
  text-shadow: 1px 1px 1px #000;
  margin: 3px 0 0 0;
}

#popupBox img {
  max-width: 100%;
  max-height: 450px;
  margin: 5px 0;
  border-radius: 5px;
  border: 2px solid #fff;
  /* 白い縁取り */
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.7);
  /* 影をつける場合 */
  box-sizing: border-box;
  /* ←追加 */
  display: block;
  /* ←余白ズレ防止 */
}

#popupClose {
  position: absolute;
  top: 15px;
  /* 上からの距離 */
  right: 15px;
  /* 右からの距離 */
  padding: 5px 10px;
  background: rgba(0, 90, 60, 0.3);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.slider {
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.slides {
  display: flex;
  transition: transform 0.4s ease;
}

.slides img {
  width: 100%;
  flex-shrink: 0;
  object-fit: cover;
}

.slide-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 60, 40, 0.7);
  color: #fff;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
}

.slide-btn.prev {
  left: 10px;
}

.slide-btn.next {
  right: 10px;
}


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1980px) {
  #popupBox {
    width: 90%;
    max-width: 800px;
  }
}

@media (max-width: 1280px) {
  #popupBox {
    width: 75%;
  }
}

@media (max-height: 800px) {
  #popupBox {
    transform: scale(0.95);
  }
}

@media (max-height: 700px) {
  #popupBox {
    transform: scale(0.9);
  }
}

@media (max-height: 550px) {
  #popupBox {
    transform: scale(0.8);
  }
}

@media (max-height: 450px) {
  #popupBox {
    transform: scale(0.6);
  }
}

@media (max-width: 768px) {
  #popupBox {
    width: 85%;
  }

  #popupTitle {
    font-size: 15px;
  }

  #popupText {
    font-size: 11px;
  }
}

/*
@media (max-height: 700px) and (max-width: 768px) {
  #popupBox {
    width: 30%;
    max-width: 500px;
    min-width: 420px;
  }
}

@media (max-height: 550px) and (max-width: 768px) {
  #popupBox {
    width: 30%;
    max-width: 500px;
    min-width: 420px;
  }
}

@media (max-height: 400px) {
  #popupBox {
    min-width: 200px;
  }
}

@media (max-height: 350px) {
  #popupBox {
    min-width: 180px;
  }
}
  */

@media (max-width: 600px) {
  #popupBox {
    width: 85%;
  }
}

@media (max-width: 390px) {
  #popupBox {
    min-width: 280px;
  }
}