/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background-color: #050505;
  color: #eee;
  overflow: hidden;
  user-select: none;
}

#app {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

#three-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* UI Structure */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: #111;
  z-index: 10;
}

/* Titles */
.glow-title {
  color: #00ffcc;
  text-shadow: 0 0 15px #00ffcc;
  font-size: 2.5rem;
  letter-spacing: 2px;
  margin-bottom: 2rem;
}

.glow-title-orange {
  color: #ff9900;
  text-shadow: 0 0 15px #ff9900;
  font-size: 2.5rem;
  letter-spacing: 2px;
}

/* Buttons Generic */
.button {
  background-color: #2a2a35;
  color: #fff;
  border: 2px solid #556;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  touch-action: manipulation;
  margin: 0.5rem;
  transition: all 0.2s ease;
}

.button:hover {
  background-color: #3b3b4a;
}

.button-primary {
  background-color: #bf2a2a;
  border-color: #ff5555;
}

.button-primary:hover {
  background-color: #d93636;
}

.topleft {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 100;
}

/* Image Buttons (Thematic) */
.img-button {
  background: linear-gradient(to bottom, #ff9900, #cc3300);
  border: 3px solid #ffcc00;
  border-radius: 8px;
  color: #fff;
  font-size: 1.5rem;
  font-weight: bold;
  padding: 1rem 3rem;
  box-shadow: 0 4px 0 #882200, 0 8px 15px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  touch-action: manipulation;
  margin: 1rem;
  text-shadow: 1px 1px 2px #000;
}

.img-button:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #882200, 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Title Screen */
.title-screen {
  background-color: #0a0a0a;
}

.title-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./assets/ui/ref_title_style.png');
  background-size: cover;
  background-position: center;
  opacity: 0.5;
  z-index: -1;
}

.title-logo {
  max-width: 80%;
  max-height: 40vh;
  margin-bottom: 3rem;
  filter: drop-shadow(0 0 20px rgba(255, 200, 0, 0.6));
}

/* Overlay HUD */
.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem;
  display: flex;
  justify-content: flex-end;
  z-index: 20;
  pointer-events: none;
}

.battery-container {
  display: flex;
  gap: 8px;
}

.battery-segment {
  width: 25px;
  height: 12px;
  background-color: #222;
  border: 1px solid #000;
  border-radius: 2px;
}

.battery-segment.filled {
  background-color: #0ff;
  border-color: #fff;
  box-shadow: 0 0 10px #0ff;
}

/* Exploration View */
.exploration-view {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: transparent !important;
}

.panorama-background {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  background-size: 200% 200%;
  /* Make it large so we can pan around */
  background-repeat: no-repeat;
  transition: background-position 0.1s linear;
  z-index: 0;
  display: none !important;
  /* Hide old panorama in favor of Three.js */
}

#three-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: none;
}

/* 探索画面の既存背景を隠す（Three.js使用時） */
.exploration-view:has(#three-container) .panorama-background {
  display: none !important;
}

.entities-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

/* --- v9: Obstacle Layer --- */
.field-obstacle {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 200px;
  /* Base width, will scale with background-size or img width */
  height: 400px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  z-index: 6;
  /* 障害物はUMA(5)より手前 */
  pointer-events: none;
}

.field-entity {
  position: absolute;
  transform: translate(-50%, -50%);
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease-out;
  z-index: 5;
  /* 障害物の背後になるように */
}

/* v9: Slide from behind obstacle */
.field-entity.hidden {
  transform: translate(calc(-50% - 40px), -50%) scale(0.9);
  opacity: 0;
}

.field-entity.revealed {
  transform: translate(calc(-50% + 15px), -50%) scale(1);
  opacity: 1;
  filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.8));
}

.has-img {
  width: 300px;
  /* Default */
  height: 400px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
}

.width-200 {
  width: 200px !important;
}

.width-300 {
  width: 300px !important;
}

.width-400 {
  width: 400px !important;
}

.placeholder-uma {
  font-size: 8rem;
  color: #111;
  text-shadow: 0 0 20px #f00;
}

.placeholder-anim {
  font-size: 8rem;
  color: #333;
  text-shadow: 0 0 10px #fff;
}

.center-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  pointer-events: none;
  z-index: 15;
}

.reticle-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 5px solid rgba(255, 255, 255, 0.6);
  transition: all 0.2s;
}

.tl {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}

.tr {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
}

.bl {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
}

.br {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background-color: #fff;
  border-radius: 50%;
}

.center-reticle.locked .reticle-corner {
  border-color: #ff3300;
  box-shadow: 0 0 15px #ff3300, inset 0 0 15px #ff3300;
}

.center-reticle.locked {
  animation: targetPulse 0.4s infinite alternate;
}

@keyframes targetPulse {
  from {
    transform: translate(-50%, -50%) scale(1.1);
  }

  to {
    transform: translate(-50%, -50%) scale(0.9);
  }
}

.shutter-container {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
}

.glass-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(150, 150, 150, 0.4));
  border: 4px solid #aaa;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  opacity: 0.3;
  touch-action: manipulation;
  transition: all 0.2s;
}

.glass-btn.active {
  opacity: 1;
  border-color: #f00;
  cursor: pointer;
  background: radial-gradient(circle at 30% 30%, rgba(255, 200, 200, 0.9), rgba(255, 0, 0, 0.6));
  box-shadow: 0 0 30px #f00, 0 10px 20px rgba(0, 0, 0, 0.5);
  animation: pulseShutter 1s infinite alternate;
}

.glass-btn.active:active {
  transform: scale(0.9);
}

@keyframes pulseShutter {
  from {
    box-shadow: 0 0 15px #f00;
  }

  to {
    box-shadow: 0 0 40px #f00;
  }
}

/* Battle View */
.battle-view {
  background-color: #000;
  background-image: url('./assets/ui/battle/bg.png');
  background-size: 100% 100%;
  background-position: center;
  position: absolute;
  inset: 0;
}

.battle-warning {
  position: absolute;
  top: 5%;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.timer-container {
  position: absolute;
  top: 20%;
  right: 10%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-bg {
  width: 150px;
  opacity: 0.8;
}

.timer-text {
  position: absolute;
  font-size: 4rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 5px #000;
}

.timer-danger {
  color: #f33;
  animation: shakeNum 0.2s infinite;
}

@keyframes shakeNum {

  0%,
  100% {
    transform: translate(0);
  }

  50% {
    transform: translate(5px, -5px);
  }
}

.battle-subject {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  height: 50vh;
  display: flex;
  align-items: flex-end;
  z-index: 5;
}

.battle-img {
  max-height: 100%;
}

.battle-placeholder {
  font-size: 15rem;
  color: #000;
}

.battle-controls {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 35vh;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.progress-bar-container {
  position: relative;
  width: 70%;
  max-width: 500px;
  height: 30px;
  margin-top: 1rem;
}

.hp-gauge-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #f00, #ff0);
  width: 0%;
  transition: width 0.1s;
  z-index: 1;
  border-radius: 20px;
}

.battle-btn-img {
  margin-top: 2rem;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f00, #800);
  border: 10px solid #400;
  color: #fff;
  font-size: 3rem;
  font-weight: bold;
  box-shadow: 0 10px 0 #300, 0 15px 20px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  touch-action: manipulation;
  z-index: 15;
  transition: transform 0.05s, box-shadow 0.05s;
}

.battle-btn-img:active {
  transform: translateY(10px);
  box-shadow: 0 0 0 #300, 0 5px 10px rgba(0, 0, 0, 0.8);
  background: #f33;
}

/* Result Animations */
.success-bg {
  background-color: #001a33;
}

.victory-img {
  max-width: 80%;
  max-height: 60vh;
  z-index: 10;
  position: relative;
}

.fade-in-scale {
  animation: popScale 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popScale {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.light-rays {
  position: absolute;
  width: 200%;
  height: 200%;
  z-index: 1;
  background: repeating-conic-gradient(from 0deg, rgba(85, 255, 255, 0.15) 0deg 15deg, transparent 15deg 30deg);
  animation: rotateRays 15s linear infinite;
}

@keyframes rotateRays {
  100% {
    transform: rotate(360deg);
  }
}

.fail-bg {
  background-color: #200;
}

.lose-img {
  max-width: 80%;
  max-height: 50vh;
  z-index: 10;
  filter: grayscale(100%) sepia(100%) hue-rotate(300deg);
}

.shake-anim {
  animation: shakeHard 0.5s ease-in-out;
}

@keyframes shakeHard {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-20px);
  }

  75% {
    transform: translateX(20px);
  }
}

.noise-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  background: url('./assets/ui/ref_damage.png');
  background-size: cover;
  mix-blend-mode: overlay;
  animation: flickerNoise 0.1s infinite;
  z-index: 20;
  pointer-events: none;
}

@keyframes flickerNoise {
  0% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

/* Encyclopedia / Dialogs */
.encyclopedia-view {
  background-color: #111;
  padding: 2rem;
  display: block !important;
  text-align: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 6rem;
  -webkit-overflow-scrolling: touch;
}

.encyclopedia-view > * {
  margin-left: auto;
  margin-right: auto;
}

.scrollable {
  overflow-y: auto;
  padding-top: 3rem;
}

.dark-blue-bg {
  background-color: #0b1320;
}

.complete-bg {
  background-color: #0a1128;
  background-image: radial-gradient(circle at top, #1a2a4a, #000);
}

.uma-card {
  width: 90%;
  max-width: 600px;
  margin: 1.5rem auto;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 1.5rem;
  border-radius: 12px;
  border: 4px solid #446;
}

.uma-card h2 {
  font-size: 2.2rem;
  color: #fff;
  margin-bottom: 1rem;
  border-bottom: 2px dashed #668;
  padding-bottom: 0.5rem;
}

.card-image-wrapper {
  height: 250px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
  background: #000;
  border-radius: 8px;
}

.report-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.card-image-placeholder {
  font-size: 8rem;
  color: #555;
}

.uma-card p {
  color: #ddd;
  font-size: 1.2rem;
  line-height: 1.6;
  text-align: left;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
}

/* Dialog Box (Captain) */
.captain-dialog {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 90%;
  max-width: 700px;
  margin: 1.5rem auto;
  background: rgba(30, 40, 60, 0.9);
  border: 3px solid #668;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.captain-portrait {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 50%;
  background: #000;
  border: 2px solid #aaa;
}

.captain-portrait-lg {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.dialog-text-box {
  flex: 1;
  color: #fff;
  font-size: 1.4rem;
  text-align: left;
  line-height: 1.5;
  text-shadow: 1px 1px 2px #000;
}

/* Grid List */
.grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 900px;
  margin: 2rem auto;
}

.ui-box {
  background: rgba(20, 25, 35, 0.9);
  border: 2px solid #456;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 180px;
}

.shadow-box {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.list-icon {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.list-ph {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}

.grid-item h3 {
  color: #fff;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.grid-item .desc {
  font-size: 0.8rem;
  color: #aaa;
  text-align: left;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.locked {
  background: #111;
  border-color: #333;
  opacity: 0.7;
}

/* Animation: Sprite */
.capture-sprite {
  width: 256px;
  height: 256px;
  background-size: 1024px 768px;
  /* 4 columns 3 rows of 256x256 frames */
  background-repeat: no-repeat;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.5);
  z-index: 15;
}


.lock-icon {
  font-size: 3rem;
  opacity: 0.5;
  margin-top: 1rem;
}

.alert-box {
  margin: 1.5rem;
  color: #ff5555;
  background: rgba(255, 0, 0, 0.1);
  padding: 1.5rem;
  border: 2px solid #ff5555;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.2rem;
}

/* ====== V2 GRAPHICS OVERRIDES ====== */

.title-bg {
  background-image: url('./assets/ui/bg/bg_title.png') !important;
  animation: zoomBgRotate 20s linear infinite alternate !important;
}

@keyframes zoomBgRotate {
  0% {
    transform: scale(1.0);
  }

  100% {
    transform: scale(1.03);
  }
}

.title-logo {
  animation: logoFadeIn 0.8s ease-out, logoFloat 3s ease-in-out infinite !important;
}

@keyframes logoFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes logoFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.panorama-background {
  animation: bgFluctuate 5s infinite alternate !important;
}

@keyframes bgFluctuate {
  from {
    filter: blur(0px) brightness(1);
  }

  to {
    filter: blur(1px) brightness(0.97);
  }
}

.fx-noise {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200%;
  background-image: url('./assets/fx/noise.png');
  opacity: 0.08;
  pointer-events: none;
  animation: noiseScroll 1s linear infinite;
  z-index: 1;
}

@keyframes noiseScroll {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-50%);
  }
}

.field-entity {
  animation: silhouetteBlink 1.5s infinite alternate !important;
}

@keyframes silhouetteBlink {
  from {
    opacity: 0.8;
  }

  to {
    opacity: 1.0;
  }
}

.center-reticle.locked {
  animation: targetSpinPulse 4s linear infinite !important;
}

@keyframes targetSpinPulse {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1.0);
    opacity: 0.6;
  }

  10% {
    opacity: 1.0;
    scale: 1.1;
  }

  20% {
    opacity: 0.6;
    scale: 1.0;
  }

  100% {
    transform: translate(-50%, -50%) rotate(360deg) scale(1.0);
  }
}

.glass-btn.active {
  animation: pulseShutter 1.0s infinite alternate, ringsBlink 0.5s infinite alternate !important;
}

@keyframes ringsBlink {
  from {
    border-color: rgba(255, 0, 0, 0.4);
  }

  to {
    border-color: rgba(255, 0, 0, 1);
  }
}

.glass-btn.active:active {
  transform: scale(0.9) !important;
  transition: transform 0.12s;
}

.battle-img {
  animation: battleUmaTremble 0.5s infinite alternate !important;
  /* v6: 0.5秒 */
}

@keyframes battleUmaTremble {
  0% {
    transform: rotate(-0.5deg) scale(1);
    /* v6: ±0.5deg 小さな揺れ */
  }

  100% {
    transform: rotate(0.5deg) scale(1.0);
  }
}

/* v7: ダメージを受けた瞬間に縮みながら小刻みに揺れる */
.battle-img.damage-shrink {
  animation: umaShrink 0.3s ease-out !important;
}

@keyframes umaShrink {
  0% {
    transform: scale(1) translateX(0);
  }

  25% {
    transform: scale(0.95) translateX(-3px);
  }

  50% {
    transform: scale(0.90) translateX(3px);
  }

  75% {
    transform: scale(0.95) translateX(-3px);
  }

  100% {
    transform: scale(1) translateX(0);
  }
}

.battle-btn-img {
  background-image: url('./assets/ui/battle/push.png') !important;
  background-size: cover;
  background-color: transparent !important;
  border: none !important;
  color: transparent !important;
  box-shadow: none !important;
  animation: pushBreath 1.2s infinite alternate !important;
  border-radius: 0 !important;
}

@keyframes pushBreath {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.08);
  }
}

.battle-btn-img:active {
  transform: scale(0.85) !important;
  transition: transform 0.1s;
  box-shadow: none !important;
  background-image: url('./assets/ui/battle/push_down.png') !important;
}

.progress-bar-fill {
  transition: width 0.08s ease-out, background 0.2s !important;
}

.timer-ring-svg {
  transform: rotate(-90deg);
  overflow: visible;
}

.timer-ring-track {
  fill: none;
  stroke: #444;
  stroke-width: 8;
}

.timer-ring-progress {
  fill: none;
  stroke: #0ff;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
  stroke-dasharray: 283;
}

.timer-danger .timer-ring-progress {
  stroke: #f00 !important;
  animation: shakeNum 0.2s infinite !important;
}

.uma-card {
  animation: cardSlideUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes cardSlideUp {
  0% {
    transform: translateY(50px) scale(1);
    opacity: 0;
  }

  80% {
    transform: translateY(0px) scale(1.05);
    opacity: 1;
  }

  100% {
    transform: translateY(0px) scale(1);
    opacity: 1;
  }
}

.encyclopedia-view {
  animation: frameBgRotate 12s linear infinite !important;
}

@keyframes frameBgRotate {
  from {
    background-position: 0% 0%;
  }

  to {
    background-position: 100% 100%;
  }
}

.captain-portrait,
.captain-portrait-lg {
  animation: captainFloat 2s infinite alternate !important;
}

@keyframes captainFloat {
  0% {
    transform: translateY(3px);
  }

  100% {
    transform: translateY(-3px);
  }
}

.captain-dialog {
  animation: dialogSlideIn 0.3s ease-out !important;
}

@keyframes dialogSlideIn {
  from {
    transform: translateX(50px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.success-bg {
  animation: bgSuccess 0.5s forwards !important;
}

@keyframes bgSuccess {
  from {
    background-color: #fff;
  }

  to {
    background-color: #001a33;
  }
}

.victory-img {
  animation: victoryScale 0.8s ease-out !important;
}

@keyframes victoryScale {
  0% {
    transform: scale(1);
    opacity: 0;
  }

  50% {
    transform: scale(1.4);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.fail-bg {
  background-color: #000 !important;
  animation: bgFail 0.5s forwards !important;
}

@keyframes bgFail {
  from {
    opacity: 0;
  }

  to {
    opacity: 0.6;
  }
}

.lose-img {
  animation: loseRetreat 0.5s forwards !important;
}

@keyframes loseRetreat {
  from {
    transform: scale(1);
    filter: blur(0px);
  }

  to {
    transform: scale(0.7);
    filter: blur(5px);
  }
}

.battery-segment:not(.filled) {
  animation: batteryLoss 0.3s forwards !important;
}

@keyframes batteryLoss {

  0%,
  50% {
    background-color: #f00;
    border-color: #f00;
  }

  100% {
    background-color: #222;
    border-color: #000;
  }
}

.lock-icon img {
  width: 50px;
  height: 50px;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.grid-item.locked:hover .lock-icon img {
  transform: scale(1.1) !important;
}

/* ====== V3 NEW STYLES ====== */

/* --- フィールドテロップ (SCR-003 内) --- */
.field-ticker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  pointer-events: none;
  text-align: center;
}

.ticker-img {
  max-width: 80vw;
  max-height: 25vh;
}

.ticker-text-fb {
  font-size: 4rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 30px #fff, 0 0 60px rgba(255, 255, 255, 0.5);
}

/* ズームアウトで出現 (0.5s delay, 800ms) */
.zoom-out-appear {
  animation: zoomOutAppear 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s both;
}

@keyframes zoomOutAppear {
  from {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }

  to {
    transform: translate(-50%, -50%) scale(1.0);
    opacity: 1;
  }
}

.field-ticker.fading {
  animation: tickerFade 0.6s ease-out forwards;
}

@keyframes tickerFade {
  to {
    opacity: 0;
  }
}

/* --- catch_text (バトル最上部テロップ, 0.5s遅延) --- */
.catch-text-img {
  max-height: 12vh;
  max-width: 90vw;
}

.catch-text-fb {
  font-size: 2.0rem;
  font-weight: bold;
  color: #fff;
}

.catch-text-delay {
  animation: fadeInAnim 0.8s ease-out 0.5s both;
}

/* --- バトル内 成功演出オーバーレイ --- */
.battle-success-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 15, 30, 0.85);
  animation: darkenIn 0.4s ease-out forwards;
}

/* --- バトル内 失敗演出オーバーレイ --- */
.battle-fail-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(60, 0, 0, 0.8);
  animation: darkenIn 0.3s ease-out forwards;
}

/* --- 白フラッシュ (成功演出最後) --- */
.battle-white-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  transition: opacity 0.3s ease-out;
}

.battle-white-flash.active {
  opacity: 1;
}

/* --- SCR-006 slide-in-right 遅延 (1.0s) --- */
.slide-in-right-delay {
  animation: slideInRight 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.0s both;
}

/* --- SCR-008 図鑑カード spinIn --- */
.report-img-spin-in {
  animation: spinFadeIn 1.0s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes spinFadeIn {
  from {
    transform: scale(0) rotate(-90deg);
    opacity: 0;
  }

  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.card-image-lg {
  height: 350px;
}

.report-card-v3 {
  max-width: 500px;
}

/* --- 動物結果 pop-in --- */
.animal-pop-in {
  animation: animalPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes animalPopIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  60% {
    transform: scale(1.1);
  }

  to {
    transform: scale(1.0);
    opacity: 1;
  }
}


/* ====== V2 NEW SCREENS ====== */

/* --- SCR-006 成功演出 --- */
.anim-success-screen {
  background-color: #000;
  position: relative;
  overflow: hidden;
}

.success-darken {
  position: absolute;
  inset: 0;
  background: rgba(0, 20, 40, 0.85);
  z-index: 1;
  animation: darkenIn 0.4s ease-out forwards;
}

@keyframes darkenIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.success-telop {
  position: absolute;
  /* v6: UMAの前面に重ねるため絶対配置 */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  /* 初期は非表示/極小 */
  z-index: 10;
  max-width: 70%;
  max-height: 20vh;
  /* v6: opacity fade ではなく zoom-up をJSフック等で制御 */
}

.success-telop.zoom-in {
  /* scale 0 -> 1.0 (800ms) */
  animation: successTelopZoom 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes successTelopZoom {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.success-telop.text-fallback {
  font-size: 4rem;
  font-weight: bold;
  color: #0ff;
  text-shadow: 0 0 30px #0ff;
  background: transparent;
  border: none;
}

.uma-zoom-anim {
  position: relative;
  z-index: 8;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.uma-zoom-img {
  max-height: 55vh;
  filter: drop-shadow(0 0 40px #0ff);
  transform: scale(0.5);
  /* 初期状態 */
  opacity: 0.3;
}

/* v7: .expanding クラスが付与されたらズーム開始 */
.uma-zoom-anim.expanding .uma-zoom-img {
  animation: umaZoom3step 1.5s ease-out forwards;
}

/* v6/v7: 暗闇からさらに拡大して画面を覆いつくす */
@keyframes umaZoom3step {
  0% {
    transform: scale(0.5);
    opacity: 0.3;
  }

  33% {
    transform: scale(0.8);
    opacity: 0.7;
  }

  66% {
    transform: scale(1.1);
    opacity: 0.9;
  }

  100% {
    transform: scale(2.5);
    /* 画面を覆いつくすように */
    opacity: 1;
  }
}

/* --- v7: FIELD ANIMATION & SHUTTER ANIMATION --- */
.shutter-zoom-active {
  z-index: 100 !important;
  animation: fieldShutterZoom 0.5s ease-in forwards !important;
  filter: drop-shadow(0 0 20px #fff) !important;
}

@keyframes fieldShutterZoom {
  0% {
    transform: translate(-50%, -50%) scale(1.0);
  }

  100% {
    /* 完全な画面全体被覆(scale:50) */
    transform: translate(-50%, -50%) scale(50.0);
  }
}

/* --- v6/v7 SHUTTER_ANIMATION (撮影直後専用画面) --- */
.shutter-anim-screen {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.shutter-anim-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.shutter-anim-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 60%;
  max-height: 60vh;
  /* 0.5秒で拡大（暗転させない） */
  animation: shutterZoomToBlack 0.5s ease-in forwards;
  filter: drop-shadow(0 0 20px #fff);
}

@keyframes shutterZoomToBlack {
  0% {
    transform: translate(-50%, -50%) scale(1.0);
    filter: drop-shadow(0 0 20px #fff);
  }

  50% {
    transform: translate(-50%, -50%) scale(3.0);
    filter: drop-shadow(0 0 10px #888);
  }

  100% {
    transform: translate(-50%, -50%) scale(10.0);
    filter: drop-shadow(0 0 0 #000);
  }
}

.shutter-anim-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 8rem;
  animation: shutterZoomToBlack 0.5s ease-in forwards;
}

/* 撮影時のズーム演出用オーバーレイ群 */
.shutter-flash-overlay {
  position: absolute;
  inset: 0;
  background-color: #000;
  opacity: 0;
  z-index: 100;
  pointer-events: none;
  animation: bgFlashDarken 1.0s ease-in forwards;
}

@keyframes bgFlashDarken {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.shutter-zoom-overlay {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 40vh;
  height: 40vh;
  object-fit: contain;
  z-index: 101;
  pointer-events: none;
  animation: figureZoomToBlack 1.0s ease-in forwards;
}

@keyframes figureZoomToBlack {
  0% {
    transform: scale(1);
    filter: brightness(1) drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
    opacity: 1;
  }

  40% {
    transform: scale(3);
    filter: brightness(0) drop-shadow(0 0 0 transparent);
    opacity: 1;
  }

  100% {
    transform: scale(15);
    filter: brightness(0);
    opacity: 1;
  }
}

/* --- SCR-006-2 確保演出 --- */
.anim-success2-screen {
  background: url('./assets/ui/battle/capture_success_bg.png') center/100% 100% no-repeat;
  flex-direction: column;
  gap: 1.5rem;
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 動物確保用の背景（濃いめの水色・もやもや） */
.animal-success-screen {
  background: linear-gradient(135deg, #0277bd 0%, #01579b 100%);
  flex-direction: column;
  gap: 1.5rem;
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mist-overlay {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 60%);
  filter: blur(60px);
  animation: mistFloating 8s infinite alternate ease-in-out;
  z-index: 1;
  pointer-events: none;
}

.mist-overlay2 {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle, rgba(135, 206, 250, 0.4) 0%, transparent 70%);
  filter: blur(40px);
  animation: mistFloating 12s infinite alternate-reverse ease-in-out;
  z-index: 1;
  pointer-events: none;
}

@keyframes mistFloating {
  0% {
    transform: translate(-10%, -10%) scale(1);
  }

  100% {
    transform: translate(10%, 10%) scale(1.2);
  }
}

/* v7: 中心から外側へ広がるキラキラした放射状エフェクト */
.golden-rays-expand {
  position: absolute;
  inset: -50%;
  background: repeating-conic-gradient(from 0deg,
      rgba(255, 204, 0, 0.4) 0deg 10deg,
      transparent 10deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #fff 0%, transparent 60%);
  mask-image: radial-gradient(circle, #fff 0%, transparent 60%);
  animation: expandRays 1.5s infinite linear;
  z-index: 1;
  pointer-events: none;
}

.golden-rays-expand.delay {
  animation-delay: 0.75s;
}

@keyframes expandRays {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  100% {
    transform: scale(2.0);
    opacity: 0;
  }
}

.uma-name-telop {
  position: absolute !important;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 60%;
  max-height: 15vh;
  z-index: 20;
}

.uma-name-telop.text-fallback-name {
  position: absolute !important;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  z-index: 20;
}

/* 動物確保画面用の名前テロップ（下部） */
.animal-name-telop {
  position: absolute !important;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 60%;
  max-height: 12vh;
  z-index: 20;
}

.animal-name-telop-text {
  position: absolute !important;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
  z-index: 20;
}

.uma-name-telop-text {
  position: absolute !important;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  letter-spacing: 4px;
  z-index: 20;
}

.uma-image-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  z-index: 10;
}

.uma-center-img {
  max-height: 50vh;
  max-width: 80vw;
  object-fit: contain;
}

.zoom-slow {
  animation: zoomSlow 20s linear infinite alternate;
}

@keyframes zoomSlow {
  from {
    transform: scale(1.0);
  }

  to {
    transform: scale(1.03);
  }
}

.get-uma-telop {
  position: absolute !important;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 60%;
  max-height: 15vh;
  z-index: 20;
}

.get-uma-telop.text-fallback {
  position: absolute !important;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  font-weight: bold;
  color: #ff9900;
  text-shadow: 0 0 20px #ff9900;
  z-index: 20;
}

/* --- SCR-007 失敗演出 --- */
.anim-fail-screen {
  background-color: #000;
  position: relative;
  overflow: hidden;
}

.fail-darken {
  position: absolute;
  inset: 0;
  background: rgba(80, 0, 0, 0.7);
  z-index: 1;
  animation: darkenIn 0.3s ease-out forwards;
}

.fail-telop {
  position: relative;
  z-index: 10;
  max-width: 70%;
  max-height: 20vh;
}

.fail-telop.text-fallback-fail {
  font-size: 4rem;
  font-weight: bold;
  color: #f33;
  text-shadow: 0 0 30px #f33;
}

.fail-telop2 {
  position: relative;
  z-index: 10;
  max-width: 50%;
  max-height: 12vh;
}

/* --- Shared animation helpers --- */
.fade-in-anim {
  animation: fadeInAnim 0.8s ease-out forwards;
}

@keyframes fadeInAnim {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.fade-in-anim-delay {
  animation: fadeInAnim 0.8s ease-out 0.5s both;
}

.slide-in-left {
  animation: slideInLeft 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s both;
}

@keyframes slideInLeft {
  from {
    transform: translateX(calc(-50% - 80px));
    opacity: 0;
  }

  to {
    transform: translateX(-50%);
    opacity: 1;
  }
}

.slide-in-right {
  animation: slideInRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(calc(-50% + 80px));
    opacity: 0;
  }

  to {
    transform: translateX(-50%);
    opacity: 1;
  }
}

/* --- Battle gauge marker --- */
.progress-bar-container {
  position: relative;
}

.gauge-marker-img {
  position: absolute;
  top: 0;
  left: 0;
  /* JS will update left dynamically */
  transform: translate(-50%, -20%) scale(1.5) !important;
  height: 150%;
  width: auto;
  z-index: 3;
  pointer-events: none;
}

/* --- Battle countdown --- */
.battle-countdown-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: 40vh;
  z-index: 20;
  animation: countdownPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

@keyframes countdownPop {
  from {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }

  to {
    transform: translate(-50%, -50%) scale(1.0);
    opacity: 1;
  }
}

/* --- BUG-2 FIX: PUSHボタン pressed state --- */
.battle-btn-img {
  background-image: url('./assets/ui/battle/push.png') !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-color: transparent !important;
  border: none !important;
  /* TEXT COLOR: keep transparent to hide any fallback text, but the img shows */
  color: transparent !important;
  box-shadow: none !important;
  animation: pushBreath 1.2s infinite alternate !important;
  border-radius: 0 !important;
  /* Ensure push image always fills button */
  min-width: 120px;
  min-height: 120px;
}

/* BUG-2 FIX: :active must not hide the button — use push_down.png but keep visible */
.battle-btn-img:active {
  background-image: url('./assets/ui/battle/push_down.png') !important;
  transform: scale(0.88) !important;
  animation: none !important;
  opacity: 1 !important;
  /* Fallback: if push_down.png missing, show a dim version of push.png */
}

/* Fallback if image load fails: show styled button instead of invisible element */
.battle-btn-img:not([style*="background-image"]),
.battle-btn-img[style*="background-image: none"] {
  background: radial-gradient(circle at 30% 30%, #f00, #800) !important;
  border-radius: 50% !important;
  border: 10px solid #400 !important;
  color: #fff !important;
}

/* --- will-change for smoother exploration panning --- */
.panorama-background {
  will-change: background-position;
}

.field-entity {
  will-change: transform, opacity;
}

/* --- ダメージエフェクト (v5) --- */
.damage-effect {
  position: absolute;
  /* left/top set dynamically */
  width: 50px;
  height: 50px;
  background: radial-gradient(circle, rgba(255, 255, 100, 1) 0%, rgba(100, 255, 100, 0.8) 40%, rgba(255, 255, 255, 0) 100%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
}

.damage-effect.damage-burst {
  animation: damageBurst 0.3s ease-out;
}

@keyframes damageBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.0);
  }
}

/* --- 金色放射背景 (SCR-006 確保演出・v5) --- */
.golden-rays-bg {
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg,
      #ffcc00 0deg 15deg, #ffaa00 15deg 30deg,
      #ffcc00 30deg 45deg, #ffaa00 45deg 60deg,
      #ffcc00 60deg 75deg, #ffaa00 75deg 90deg,
      #ffcc00 90deg 105deg, #ffaa00 105deg 120deg,
      #ffcc00 120deg 135deg, #ffaa00 135deg 150deg,
      #ffcc00 150deg 165deg, #ffaa00 165deg 180deg,
      #ffcc00 180deg 195deg, #ffaa00 195deg 210deg,
      #ffcc00 210deg 225deg, #ffaa00 225deg 240deg,
      #ffcc00 240deg 255deg, #ffaa00 255deg 270deg,
      #ffcc00 270deg 285deg, #ffaa00 285deg 300deg,
      #ffcc00 300deg 315deg, #ffaa00 315deg 330deg,
      #ffcc00 330deg 345deg, #ffaa00 345deg 360deg);
  animation: goldenRaysRotate 12s linear infinite;
  z-index: 1;
  opacity: 0.5;
}

@keyframes goldenRaysRotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.anim-success2-screen .uma-name-telop,
.anim-success2-screen .uma-name-telop-text,
.anim-success2-screen .success-catch-telop,
.anim-success2-screen .uma-zoom-anim2,
.anim-success2-screen .uma-image-center,
.anim-success2-screen .get-uma-telop {
  position: relative;
  z-index: 5;
  /* In front of golden rays */
}