body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }

/* ===== ズームアナログメーター ===== */
#zoom-meter {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
  height: 200px;
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

#zoom-meter-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: monospace;
  font-size: 10px;
  font-weight: bold;
  color: #FFF8E0;
  text-align: right;
  padding: 1px 0;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000;
}

#zoom-meter-track {
  width: 18px;
  background: rgba(20, 10, 0, 0.85);
  border: 2px solid #5A3A1A;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

/* 閾値ライン (zoom=12、下から60%) */
#zoom-meter-track::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 60%;
  height: 2px;
  background: rgba(255, 50, 20, 0.9);
  z-index: 2;
}

/* 塗りつぶし (グラデーション固定200px、下に固定) */
#zoom-meter-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top,
    #2244EE 0%, #44AAFF 56%,
    #FF8822 62%, #FF2200 100%);
  background-size: 100% 200px;
  background-position: bottom center;
  transition: height 0.12s linear;
  height: 0%;
}

/* 現在値ニードル */
#zoom-meter-needle {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 248, 224, 0.95);
  box-shadow: 0 0 4px rgba(255, 220, 100, 0.9);
  transition: bottom 0.12s linear;
  bottom: 0%;
  z-index: 3;
}

#joystick-container {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 96px;
  height: 96px;
  z-index: 10;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#joystick-base {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255, 248, 224, 0.75);
  border: 3px solid #5A3A1A;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  cursor: pointer;
}

/* 十字の目安線 */
#joystick-base::before,
#joystick-base::after {
  content: '';
  position: absolute;
  background: rgba(90, 58, 26, 0.2);
}
#joystick-base::before {
  width: 1px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}
#joystick-base::after {
  width: 100%;
  height: 1px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

#joystick-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #A07840, #5A3A1A);
  border: 2px solid #2A1A00;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.12s ease;
}

#joystick-thumb.dragging {
  transition: none;
}

#altitude-controls {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.altitude-btn {
  padding: 6px 16px;
  font-size: 14px;
  font-weight: bold;
  font-family: sans-serif;
  border: 3px solid #5A3A1A;
  border-radius: 8px;
  background: rgba(255, 248, 224, 0.85);
  color: #5A3A1A;
  cursor: pointer;
  box-shadow: 0 3px 0 #5A3A1A;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
  user-select: none;
}

.altitude-btn:hover {
  background: rgba(255, 240, 180, 0.95);
}

.altitude-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.altitude-btn.active {
  background: #5A3A1A;
  color: #FFF8E0;
  box-shadow: 0 3px 0 #2A1A00;
}

/* ===== ナレーションウィンドウ ===== */
#narration {
  position: absolute;
  bottom: 24px;
  right: 64px;
  width: 240px;
  background: rgba(10, 5, 0, 0.92);
  border: 3px solid #5A3A1A;
  border-radius: 6px;
  padding: 10px 14px 8px;
  box-shadow: 4px 4px 0 #2A1A00;
  z-index: 15;
  pointer-events: none;
  /* 初期状態: 画面下に隠す */
  transform: translateY(calc(100% + 32px));
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
#narration.visible {
  transform: translateY(0);
}
#narration-text {
  font-family: 'Noto Sans', sans-serif;
  font-size: 13px;
  color: #FFF8E0;
  margin: 0 0 4px;
  line-height: 1.6;
}
#narration-cursor {
  display: block;
  text-align: right;
  color: #FFCC44;
  font-size: 10px;
  animation: cursor-blink 0.8s step-end infinite;
}
@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* ===== プレイヤーインジケーター (UFO) ===== */
#player-indicator {
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
  z-index: 5;
}

/* UFO ふわふわアニメーション (translateY で上下、scaleX/Y で水平扁平) */
@keyframes ufo-float {
  0%, 100% { transform: translateX(-50%) scaleX(1.15) scaleY(0.68) translateY(0px); }
  50%       { transform: translateX(-50%) scaleX(1.15) scaleY(0.68) translateY(-9px); }
}

/* 影: UFO が上がると薄く小さく */
@keyframes ufo-shadow-float {
  0%, 100% { transform: translateX(-50%) scaleX(1.0); opacity: 1;    }
  50%       { transform: translateX(-50%) scaleX(0.75); opacity: 0.45; }
}

#ufo {
  position: absolute;
  left: 0;
  line-height: 1;
  user-select: none;
  transition: font-size 0.4s ease, bottom 0.4s ease;
  animation: ufo-float 2.4s ease-in-out infinite;
}

#ufo-shadow {
  position: absolute;
  left: 0;
  border-radius: 50%;
  transition: width 0.4s ease, height 0.4s ease, top 0.4s ease,
              background 0.4s ease, filter 0.4s ease;
  animation: ufo-shadow-float 2.4s ease-in-out infinite;
}

#ufo-crosshair {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
}
#ufo-crosshair::before,
#ufo-crosshair::after {
  content: '';
  position: absolute;
  background: #ff1111;
}
#ufo-crosshair::before {
  /* 横棒 */
  width: 100%;
  height: 2px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}
#ufo-crosshair::after {
  /* 縦棒 */
  width: 2px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

/* 上空モード: 大型UFO・高い位置・広い影 */
#player-indicator[data-altitude="high"] #ufo {
  font-size: 72px;
  bottom: 22px;
}
#player-indicator[data-altitude="high"] #ufo-shadow {
  width: 64px;
  height: 18px;
  top: 3px;
  background: rgba(0, 0, 0, 0.20);
  filter: blur(6px);
}

/* 低空モード: 小型UFO・低い位置・小さい影 */
#player-indicator[data-altitude="low"] #ufo {
  font-size: 40px;
  bottom: 12px;
}
#player-indicator[data-altitude="low"] #ufo-shadow {
  width: 34px;
  height: 10px;
  top: 2px;
  background: rgba(0, 0, 0, 0.35);
  filter: blur(2px);
}

/* ===== 移動方向矢印 ===== */
#move-arrow-wrap {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

#move-arrow {
  position: absolute;
  width: 12px;
  height: 18px;
  left: -6px;
  top: -30px;  /* 矢先がクロスヘアから約30px上に来る位置 */
  /* ↑ 矢印の形 (頭+軸) */
  clip-path: polygon(50% 0%, 0% 45%, 32% 45%, 32% 100%, 68% 100%, 68% 45%, 100% 45%);
  background: rgba(255, 60, 60, 0.95);
  filter: drop-shadow(0 0 3px rgba(255, 100, 80, 0.8));
}
