/* ===== 土台 ===== */
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;
  --scale-narrator: 1;
  --scale-narrator_random: 1;
}

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

@media (min-width: 1920px) {
  :root {
    --scale: 1.15;
    --scale-bubble: 1.15;
    --scale-narrator: 1;
  }
}

@media (min-width: 2560px) {
  :root {
    --scale: 1.2;
    --scale-bubble: 1.2;
    --scale-narrator: 1;
  }
}

/* ===== ローディング ===== */
#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: 16px;
  bottom: 0;
  width: calc(110px * var(--scale-narrator));
  max-height: 100vh;
  object-fit: contain;

  /* ナレーター画像自体はクリックを邪魔しない */
  pointer-events: none;

  z-index: 12;

  filter:
    drop-shadow(
      0 6px 18px rgba(0, 0, 0, .35)
    );
}

#narrator_random {
  position: fixed;
  right: 16px;
  bottom: 0;
  width: calc(110px * var(--scale-narrator));
  max-height: 100vh;
  object-fit: contain;

  /* ナレーター画像自体はクリックを邪魔しない */
  pointer-events: none;

  z-index: 12;

  filter:
    drop-shadow(
      0 6px 18px rgba(0, 0, 0, .35)
    );
}


/* =========================================================
   セリフ帯
========================================================= */

#speech {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  padding: calc(5px * var(--scale));

  text-align: center;

  /*
   * 重要
   * セリフ帯の透明部分はクリックを透過させる
   */
  pointer-events: none;

  z-index: 13;

  transition:
    transform 0.5s ease,
    opacity 0.5s ease;
}


/* =========================================================
   セリフ帯内で実際に操作するものだけクリック可能
========================================================= */

#speech .inline-btn,
#speech .choice-btn,
#speech .tour-nav-btn,
#speech .close-btn {
  pointer-events: auto;
}


/* =========================================================
   選択肢ボタン
========================================================= */

.choice-group {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}


/* =========================================================
   学科テーマカラー
========================================================= */

body[data-theme="color01"] {
  --main-color: rgb(100, 170, 240);
}

body[data-theme="color02"] {
  --main-color: rgb(240, 120, 120);
}

body[data-theme="color03"] {
  --main-color: rgb(255, 170, 200);
}

body[data-theme="color04"] {
  --main-color: rgb(255, 190, 120);
}

body[data-theme="color05"] {
  --main-color: rgb(255, 235, 120);
}

.choice-btn {
  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;

  background: rgb(255, 36, 70);
  color: #fff;

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

  cursor: pointer;

  pointer-events: auto;
}

body[data-theme] .choice-btn {
  background: var(--main-color);
  color: #000;
}

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

.choice-btn.dept-btn {
  color: #000;
}

.choice-btn.dept-btn.color01 {
  background: rgb(100, 170, 240);
}

.choice-btn.dept-btn.color02 {
  background: rgb(240, 120, 120);
}

.choice-btn.dept-btn.color03 {
  background: rgb(255, 170, 200);
}

.choice-btn.dept-btn.color04 {
  background: rgb(255, 190, 120);
}

.choice-btn.dept-btn.color05 {
  background: rgb(255, 235, 120);
}

.choice-btn.dept-btn:hover {
  filter: brightness(0.95);
}


/* =========================================================
   吹き出し
========================================================= */

#bubble {
  position: relative;

  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));

  font-size: calc(16px * var(--scale-bubble));
  line-height: 1.8;

  font-family:
    "Yu Gothic",
    "Segoe UI",
    sans-serif;

  box-shadow:
    0 6px 18px rgba(0, 0, 0, .15);

  width: fit-content;
  max-width: 80vw;
  min-width: 300px;

  margin: 0 auto;

  word-wrap: break-word;
}

#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;

  background: rgb(255, 36, 70);
  color: #fff;

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

  font-size:
    calc(15px * var(--scale-bubble));

  font-weight: 600;

  cursor: pointer;

  pointer-events: auto;
}

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


/* =========================================================
   スマホ
========================================================= */

@media (max-width: 600px) {

  #speech {
    display: block;
  }

  #narrator {
    right: -30px !important;
    bottom: 0 !important;
    max-height: 15vh !important;
    position: fixed;
  }

  #narrator_random {
    right: -30px !important;
    bottom: 0 !important;
    max-height: 15vh !important;
    position: fixed;
  }

  #bubble {
    max-width: 90vw;
    min-width: auto;
    padding: 12px 14px;
  }
}


/* =========================================================
   PC
========================================================= */

@media (min-width: 601px) {

  #speech-inner {
    display: flex;
    justify-content: center;
    align-items: flex-end;

    gap:
      calc(5px * var(--scale));

    white-space: nowrap;
  }

  #bubble {
    max-width: 70vw;
    margin: 0;
    white-space: normal;
  }

  #narrator {
    position: relative;
    right: 0;
    bottom: 0;

    width:
      calc(130px * var(--scale-narrator));

    max-height: 40vh;

    flex-shrink: 0;
  }

  #narrator_random {
    position: absolute;
    right: 20%;
    bottom: 0;

    width:
      calc(130px * var(--scale-narrator));

    max-height: 40vh;

    flex-shrink: 0;
  }
}


/* =========================================================
   最終ページ用
========================================================= */

.vr-floating-btn {
  display: inline-block;

  margin-top:
    calc(16px * var(--scale-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;

  pointer-events: auto;
}

.vr-floating-btn:hover {
  background: rgb(75, 198, 173);
}


/* =========================================================
   ポップアップ
========================================================= */

.overlay {
  position: fixed;
  inset: 0;

  width: 100%;
  height: 100%;

  display: none;

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

  z-index: 20;

  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;

  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;

  pointer-events: auto;
}

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

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


/* =========================================================
   左上ボタン
========================================================= */

.special-btn {
  position: fixed;

  top: 60px;
  left: 20px;

  padding: 14px 24px;

  background:
    linear-gradient(
      135deg,
      #667eea 0%,
      #764ba2 100%
    );

  color: white;

  border: none;

  border-radius: 12px;

  font-size: 16px;
  font-weight: 600;

  cursor: pointer;

  display: none;

  z-index: 10000;

  box-shadow:
    0 4px 15px rgba(102, 126, 234, 0.4);

  transition: all 0.3s ease;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Hiragino Kaku Gothic ProN",
    "Hiragino Sans",
    Meiryo,
    sans-serif;

  pointer-events: auto;
}

.special-btn:hover {
  transform: translateY(-2px);

  box-shadow:
    0 6px 20px rgba(102, 126, 234, 0.5);
}

.special-btn:active {
  transform: translateY(0);
}


/* =========================================================
   ボタンエリアのクリック保護
========================================================= */

.button-overlay {
  position: fixed;

  top: 0;
  left: 0;

  width: 200px;
  height: 100px;

  z-index: 9999;

  pointer-events: none;

  display: none;
}

.button-overlay.active {
  display: block;
  pointer-events: auto;
}


/* =========================================================
   アニメーション
========================================================= */

@keyframes fadeIn {

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

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

}


/* =========================================================
   ポップアップ サイズ
========================================================= */

@media (max-width: 1980px) {

  .popupBox,
  .exPopupBox {
    width: 90%;
    max-width: 800px;
  }

}

@media (max-width: 1280px) {

  .popupBox,
  .exPopupBox {
    width: 75%;
  }

}

@media (max-height: 800px) {

  .popupBox,
  .exPopupBox {
    transform: scale(0.95);
  }

}

@media (max-height: 700px) {

  .popupBox,
  .exPopupBox {
    transform: scale(0.9);
  }

}

@media (max-height: 550px) {

  .popupBox,
  .exPopupBox {
    transform: scale(0.8);
  }

}

@media (max-height: 450px) {

  .popupBox,
  .exPopupBox {
    transform: scale(0.6);
  }

}

@media (max-width: 768px) {

  .popupBox,
  .exPopupBox {
    width: 85%;
  }

  .popupTitle {
    font-size: 15px;
  }

  .popupText {
    font-size: 11px;
  }

}

@media (max-width: 600px) {

  .popupBox,
  .exPopupBox {
    width: 100%;
  }

}

@media (max-width: 390px) {

  .popupBox,
  .exPopupBox {
    min-width: 280px;
  }

}


/* =========================================================
   セリフ帯 開閉
========================================================= */

#speech.hidden {
  transform: translateY(120%);
  opacity: 0;
}


/* =========================================================
   吹き出しヘッダー
========================================================= */

.bubble-header {
  position: absolute;
  top: 0;
  left: 0;
}


/* 閉じるボタン */

.close-btn {
  position: absolute;

  /*
  top: -25px;
  left: 0;
  */

  top: -7px;
  left: 0px;

  cursor: pointer;

  pointer-events: auto;
}


/* =========================================================
   再表示ボタン
========================================================= */

.open-btn {
  display: none;

  position: fixed;

  bottom: 20px;
  left: 50%;

  transform: translateX(-50%);

  cursor: pointer;

  z-index: 10;

  pointer-events: auto;
}

.open-btn.active {
  display: block;
}


/* =========================================================
   VRツアー ページナビゲーション
========================================================= */

#tour-navigation {
  display: flex;

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

  gap: 10px;

  flex-wrap: wrap;

  margin-top: 14px;

  /*
   * ナビゲーション自体は操作可能
   */
  pointer-events: auto;
}


/* =========================================================
   施設ナビボタン
========================================================= */

.tour-nav-btn {
  padding:
    calc(8px * var(--scale-bubble))
    calc(16px * var(--scale-bubble));

  border:
    2px solid rgba(255, 255, 255, 0.8);

  border-radius: 9999px;

  background: rgba(70, 180, 110, 0.9);

  color: #fff;

  font-size:
    calc(14px * var(--scale-bubble));

  font-weight: 600;

  font-family:
    "Yu Gothic",
    "Segoe UI",
    sans-serif;

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

  cursor: pointer;

  transition:
    transform 0.15s ease,
    filter 0.15s ease,
    background 0.15s ease;

  pointer-events: auto;
}

.tour-nav-btn:hover {
  filter: brightness(1.08);
}

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


/* =========================================================
   コース選択ボタン
========================================================= */

.tour-nav-btn.course-select-btn {
  background: rgba(60, 120, 200, 0.95);
}


/* =========================================================
   コース名
========================================================= */

.tour-course-name {
  font-size:
    calc(13px * var(--scale-bubble));

  font-weight: 600;

  color: #555;

  margin-bottom: 3px;

  text-align: center;
}


/* =========================================================
   施設名
========================================================= */

.tour-facility-name {
  font-size:
    calc(19px * var(--scale-bubble));

  font-weight: 700;

  color: #222;

  text-align: center;

  margin-bottom: 3px;
}


/* =========================================================
   tourページのbubble
========================================================= */

body[data-page="tour"] #bubble {

  padding-top:
    calc(5px * var(--scale-bubble));

  padding-bottom:
    calc(5px * var(--scale-bubble));

}


/* =========================================================
   スマホ
========================================================= */

@media (max-width: 600px) {

  #tour-navigation {

    gap: 6px;

    margin-top: 10px;

  }

  .tour-nav-btn {

    padding:
      7px 11px;

    font-size: 13px;

  }

  .tour-course-name {
    font-size: 11px;
  }

  .tour-facility-name {
    font-size: 16px;
  }

}
