:root{
  --ink:#e9f0ff;
  --bg:#0b0b0c;
  --poi-grad-1:rgba(255,255,255,.16);
  --poi-grad-2:rgba(255,255,255,.04);
  --poi-border:rgba(255,255,255,.22);
  --poi-shadow:0 8px 28px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  --anchor:0.28;
  --spacer-top:8vh;
  --spacer-bottom:calc((1 - var(--anchor)) * 100vh);
  --step-pt:45vh;
  --step-pb:45vh;
  --first-step-pt:14vh;
}

html,body{height:100%;margin:0}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Noto Sans JP,sans-serif
}

.three-layer {
  position: fixed !important;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  backface-visibility: hidden;
}

.three-layer canvas,
#application-canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

main {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.spacer-top{height:var(--spacer-top)}
.spacer-bottom{height:var(--spacer-bottom)}

.step {
  padding:var(--step-pt) 24px var(--step-pb);
  pointer-events: none;
}

.step:first-of-type{
  padding-top:var(--first-step-pt);
  padding-bottom:calc(var(--step-pt) + var(--step-pb) - var(--first-step-pt));
}

.step h1 .en {
  font-size: 0.6em; /* 日本語の60%のサイズにする */
  font-weight: 400; /* 英語は太く見えがちなので少し細くする */
  line-height: 1.2; /* 行間を個別に調整したい場合 */
  display: inline-block; /* 必要に応じてブロック挙動を安定させる */
}

.step h2,
.step p {
  pointer-events: auto;
}

.step .content {
  max-width: 650px;
  padding: 1.2em 2em 1.5em;
  background: rgba(20, 22, 28, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  width: fit-content;
}

.step h2 {
  top: 8vh;
  z-index: 1;
  margin: 0 0 .7rem;
  display: inline-flex;
  gap: .6ch;
  align-items: stretch;
  font-weight: 700;
  letter-spacing: .02em;
  font-size: clamp(28px, 5.6vw, 42px);
  line-height: 1.12;
  color: #f6fbff;
}

.step h2::before {
  content: "";
  display: inline-block;
  width: .34em;
  border-radius: .2em;
  background: linear-gradient(180deg, #7bd6ff, #6f9bff 60%, #a3b6ff);
  box-shadow: 0 0 10px rgba(99, 163, 255, .5);
}

.step h2 .en {
  font-size: 0.6em; /* 日本語の60%のサイズにする */
  font-weight: 400; /* 英語は太く見えがちなので少し細くする */
  line-height: 1.2; /* 行間を個別に調整したい場合 */
  display: inline-block; /* 必要に応じてブロック挙動を安定させる */
}

.step p{
  margin:0;
  line-height:1.9;
  letter-spacing:.01em;
  font-size:clamp(19px, 2.2vw, 22px);
}

.site-footer {
  position: relative;
  z-index: 2;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: #aaa;
  background: transparent;
  padding: 1em 0;
  margin-top: 3rem;
  pointer-events: auto;
}
.site-footer p { margin: 0.2em 0; }
@media (max-width: 600px) { .site-footer { font-size: 10px; } }

body.is-loading { overflow: hidden; }
#app-splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background-color: #000;
  z-index: 9999;
  opacity: 1;
  pointer-events: all;
  transition: opacity .35s ease;
  overflow: hidden;
}
#app-splash::before {
  content: '';
  position: absolute;
  inset: -20px;
  background-image: url('./title.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(8px);
  z-index: 0;
}
#app-splash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}
#app-splash.is-hidden {
  opacity: 0;
  pointer-events: none;
}
#app-splash .splash-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
#app-splash .loading-text {
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 700;
  color: #fff;
  text-align: center;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
#app-splash .spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.9);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #app-splash .spinner { animation: none; } }

#gyro-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans JP, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(30, 32, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  pointer-events: auto;
}
#gyro-btn:hover {
  background: rgba(45, 48, 56, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
}
#gyro-btn svg {
  width: 1.2em;
  height: 1.2em;
}
@media (max-width: 600px) {
  #gyro-btn {
    padding: 8px 14px;
    font-size: 13px;
    gap: 6px;
  }
}

#limit-indicator-container {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  overflow: hidden;
}
.limit-indicator {
  position: absolute;
  background: linear-gradient(90deg, rgba(255,80,80,0), rgba(255,80,80,0.8), rgba(255,80,80,0));
  box-shadow: 0 0 12px rgba(255, 80, 80, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
.limit-indicator.is-visible {
  opacity: 1;
  transition-duration: 0.05s;
}
#limit-top, #limit-bottom {
  left: 0; right: 0; height: 4px;
}
#limit-left, #limit-right {
  top: 0; bottom: 0; width: 4px;
  background: linear-gradient(0deg, rgba(255,80,80,0), rgba(255,80,80,0.8), rgba(255,80,80,0));
}
#limit-top { top: 0; }
#limit-bottom { bottom: 0; }
#limit-left { left: 0; }
#limit-right { right: 0; }

/* ============================================================================
   サムネイルドロワー
   ============================================================================ */

#thumbnail-drawer {
  position: fixed;
  z-index: 500;
}

#drawer-toggle {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 501;
  width: 52px;
  height: 52px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 32, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  pointer-events: auto;
}

#drawer-toggle:hover {
  background: rgba(45, 48, 56, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

#drawer-toggle svg {
  width: 22px;
  height: 22px;
}

#drawer-panel {
  position: fixed;
  right: -320px;
  top: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: rgba(16, 18, 22, 0.96);
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 502;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  box-shadow: -4px 0 24px rgba(0,0,0,0.5);
  pointer-events: auto;
}

#thumbnail-drawer.is-open #drawer-panel {
  right: 0;
}

#drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

#drawer-close {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

#drawer-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

#drawer-content {
  flex: 1;
  overflow: hidden; /* スクロールなし */
  padding: 12px;
  
  display: grid;
  gap: 8px;
  align-content: start;
  
  /* 【基本設定】高さに余裕がある時は「2列」で大きく表示 */
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: min-content;
}

/* 【調整1】画面の高さが少し低い時（750px以下）は「3列」にして詰め込む */
@media (max-height: 750px) {
  #drawer-content {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 【調整2】画面の高さがかなり低い時（550px以下）は「4列」にして限界まで収める */
@media (max-height: 550px) {
  #drawer-content {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* サムネイルが小さい時は文字も少し小さく調整 */
  .thumb-label {
    font-size: 8px;
    padding: 1px 2px;
  }
}

/* サムネイルが小さくなるため、ラベル（文字）も少し小さく調整 */
.thumb-label {
  font-size: 9px;
  padding: 1px 3px;
  bottom: 2px;
  right: 2px;
}

.drawer-thumb-item {
  position: relative;
  aspect-ratio: 16/10;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s ease;
}

.drawer-thumb-item:hover {
  border-color: rgba(123, 214, 255, 0.6);
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(123, 214, 255, 0.2);
}

.drawer-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-label {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

#drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 499;
  pointer-events: none;
  transition: background 0.35s ease;
}

#thumbnail-drawer.is-open #drawer-overlay {
  background: rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

/* モバイル対応 */
@media (max-width: 600px) {
  #drawer-toggle {
    top: 16px;
    bottom: auto;
    width: 48px;
    height: 48px;
  }
  
  #drawer-toggle svg {
    width: 20px;
    height: 20px;
  }
  
  #drawer-panel {
    width: 280px;
    right: -300px;
  }
  
  #drawer-content {
    padding: 12px;
    gap: 10px;
  }
}

/* ============================================================================
   スティッキーコンテンツ
   ============================================================================ */

.sticky-content-container {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

.sticky-content-container.is-visible {
  opacity: 1;
}

.sticky-content-container .sticky-content {
  pointer-events: none;
  max-width: 640px;
  
  /* ▼ .step .content と同じパディングに変更（広すぎる場合は数値を小さくしてください） */
  padding: 0.5em 1em 0.5em;

  background: rgba(20, 22, 28, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);

  width: auto;
  max-width: 90vw;

  color: var(--ink);
  font-size: clamp(14px, 2.4vw, 32px);
  line-height: 1.6;
}

.sticky-content-container .sticky-content[data-style="transparent"] {
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}

.sticky-content-container.is-visible .sticky-content {
  pointer-events: auto; /* 表示時のみイベントを受け付ける */
}

.sticky-content-container .sticky-content h1 {
  margin: 0 0 0.5em;
  font-size: clamp(28px, 6vw, 96px);
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 4px 24px rgba(0, 0, 0, 0.6);
}

/* スティッキーコンテンツ内のh1の日英併記用スタイル */
.sticky-content-container .sticky-content h1 .en {
  display: block;        /* 強制的に改行させる（<br>不要） */
  font-size: 0.70em;     /* 日本語(h1)の70%のサイズにする */
  font-weight: 400;      /* 太さを標準に戻してスッキリさせる */
  line-height: 0.2;      /* 行間を調整 */
  margin-top: 0.1em;     /* 日本語との間に少し隙間を空ける */
  text-align: center;    /* ★これを追加：日本語の幅に対して中央揃えにする */
}

.sticky-content-container .sticky-content h2 {
  margin: 0 0 0.5rem; /* 下の余白を少し調整 */
  font-size: clamp(24px, 5vw, 40px);
  font-weight: 700;
  color: #f6fbff;
  
    /* ▼ 縦線とテキストを横並びにする設定 */
  display: inline-flex;
  gap: .6ch;           /* 線と文字の間隔 */
  align-items: stretch;
  line-height: 1.12;
}

.sticky-content-container .sticky-content h2::before {
  content: "";
  display: inline-block;
  width: .34em;
  border-radius: .2em;
  
  background: linear-gradient(180deg,#7bd6ff,#6f9bff 60%,#a3b6ff);
  box-shadow: 0 0 10px rgba(99,163,255,.5);
  
  flex-shrink: 0; /* 線が潰れないように固定 */
}

.sticky-content-container .sticky-content h3,
.sticky-content-container .sticky-content h4 {
  margin: 0 0 0.5em;
  font-size: clamp(16px, 2.8vw, 32px);
  font-weight: 700;
  color: #000000;
}

.sticky-content-container .sticky-content p {
  margin: 0;
}

.sticky-content-container .sticky-content img {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 0.8em;
}

/* 位置プリセット */
.sticky-content-container[data-position="top-left"] {
  top: 20px;
  left: 20px;
}

.sticky-content-container[data-position="top-center"] {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.sticky-content-container[data-position="top-right"] {
  top: 20px;
  right: 20px;
}

.sticky-content-container[data-position="center-left"] {
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
}

.sticky-content-container[data-position="center"] {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.sticky-content-container[data-position="center-right"] {
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
}

.sticky-content-container[data-position="bottom-left"] {
  bottom: 80px;
  left: 20px;
}

.sticky-content-container[data-position="bottom-center"] {
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
}

.sticky-content-container[data-position="bottom-right"] {
  bottom: 80px;
  right: 20px;
}

/* モバイル自動配置 */
@media (max-width: 600px) {
  .sticky-content-container .sticky-content {
    max-width: calc(100vw - 32px);
    padding: 0.9em 1.2em;
    margin-inline: auto;
    text-align: center;
  }
  
  .sticky-content-container[data-position="top-left"],
  .sticky-content-container[data-position="top-right"],
  .sticky-content-container[data-position="top-center"] {
    top: 16px;
    left: 16px;
    right: 16px;
    transform: none;
  }
  
  .sticky-content-container[data-position="center-left"],
  .sticky-content-container[data-position="center-right"] {
    top: auto;
    bottom: 100px;
    left: 16px;
    right: 16px;
    transform: none;
  }

  .sticky-content-container[data-position="center"] {
    top: 50%;
    left: 50%;
    bottom: auto;
    right: auto;
    transform: translate(-50%, -50%);
    
    /* auto だと縮こまって改行されることがあるため max-content にする */
    width: max-content;
    max-width: calc(100% - 32px);
    
    text-align: center;
    
    /* 日本語の単語途中での改行を禁止する */
    word-break: keep-all;
    overflow-wrap: break-word;
  }
  
  .sticky-content-container[data-position="bottom-left"],
  .sticky-content-container[data-position="bottom-right"],
  .sticky-content-container[data-position="bottom-center"] {
    bottom: 100px;
    left: 16px;
    right: 16px;
    transform: none;
  }

  /* h2（縦線とタイトル）をフレックスボックス化して中央揃えにする */
  .sticky-content-container .sticky-content h2 {
    display: flex;        /* inline-flexからflexに変更して幅を確保 */
    justify-content: center; /* アイテム（縦線と文字）を中央寄せ */
    width: 100%;          /* 親要素の幅いっぱいに広げる */
  }
}

@media (max-width: 600px) {
  
  /* スクロールコンテンツ（.step）のモバイル調整 */
  .step .content {
    /* 余白を狭くして、スマホ画面での表示領域を確保 */
    padding: 1.2em 1.2em 1.5em; 
    
    /* 画面幅いっぱいに広がらないようにしつつ、はみ出しを防止 */
    max-width: calc(100vw - 32px); 
    box-sizing: border-box;
  }

  /* 見出しサイズの調整 */
  .step h2 {
    /* 最小サイズを28pxから24pxに下げて圧迫感を減らす */
    font-size: clamp(24px, 6vw, 32px);
    display: flex;
    /* PC同様、縦線を伸ばす設定（念のため継承を確認） */
    align-items: stretch;
    gap: 10px;
  }

  .step h2::before {
    height: auto;   /* 親(h2)の高さに合わせて伸びる */
    flex-shrink: 0; /* 潰れないように固定 */
  }

  /* h2の縦線を枠の高さに合わせる修正 */
  /* テキストを囲むspanをブロック化し、高さの計算を確定させる */
  .step h2 > span {
    display: block; 
    flex: 1; /* 残りの横幅を埋める */
  }

  /* 英語部分のサイズ修正 */
  .step h2 .en {
    display: block;
    line-height: 1.1;
    margin-top: 4px;

    font-size: 16px;   
  }

  /* 本文サイズの調整（お好みで。少し小さくすると読みやすくなります） */
  .step p {
    font-size: clamp(16px, 4vw, 19px);
  }
}
