/* Modern RPG Game Design System - Roguelike Dungeon & Visual Novel City Map */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=MedievalSharp&family=Nunito:wght@400;600;700;800&family=Press+Start+2P&display=swap');

:root {
  --bg-dark: #0d0e15;
  --bg-card: #161824;
  --bg-card-hover: #202334;
  --panel-border: #3b405d;
  --panel-glow: rgba(78, 205, 196, 0.25);
  
  --primary: #4ecdc4;
  --primary-hover: #38b2ac;
  --accent-gold: #ffd166;
  --accent-gold-glow: rgba(255, 209, 102, 0.4);
  --accent-crimson: #ef233c;
  --accent-crimson-glow: rgba(239, 35, 60, 0.4);
  --accent-emerald: #06d6a0;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-gold: #ffd166;
  
  --font-title: 'MedievalSharp', cursive, serif;
  --font-body: 'MedievalSharp', cursive, sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
  --font-fantasy: 'MedievalSharp', cursive, serif;

  --dialogue-transparency: 30%;
  --dialogue-bg-alpha: 0.70;

  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.8), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px rgba(78, 205, 196, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 30%, #1a1c2b 0%, #0c0d14 100%);
  overflow: hidden;
}

/* ========================================================
   SCREEN MANAGEMENT
======================================================== */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.screen.active {
  display: flex;
  opacity: 1;
  z-index: 20;
}

/* ========================================================
   1. TITLE SCREEN (Multi-Layer Cinematic Animated System)
======================================================== */
#title-screen {
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  background-color: #05050a;
}

/* Layer Base Classes */
.title-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  will-change: opacity, transform;
}

.title-layer-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Layer 1: Constant Dark Void Base Backdrop */
.title-layer-base {
  z-index: 1;
  opacity: 1;
}

/* Layer 2 & 3: Landscape Layers (20s Cycle: 8s green + 2s crossfade + 8s purple + 2s crossfade) */
.title-landscape-green {
  z-index: 2;
  animation: titleCycleGreen 20s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.title-landscape-purple {
  z-index: 3;
  animation: titleCyclePurple 20s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Layer 4 & 5: Goddess Characters (Floating + Additive Glow) */
.title-char-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.title-char-green {
  z-index: 4;
  animation: titleCycleGreen 20s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.title-char-purple {
  z-index: 5;
  animation: titleCyclePurple 20s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.title-char-float-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  animation: titleGoddessFloat 5.8s ease-in-out infinite alternate;
  will-change: transform;
}

.title-char-purple .title-char-float-wrap {
  animation: titleGoddessFloat 5.2s ease-in-out infinite alternate-reverse;
}

/* Additive Glow Shaders for Goddess Characters */
.title-char-glow-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
  will-change: opacity, filter, -webkit-mask-position, mask-position;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 42%,
    rgba(0, 0, 0, 0.85) 54%,
    rgba(0, 0, 0, 0.45) 68%,
    rgba(0, 0, 0, 0.08) 82%,
    rgba(0, 0, 0, 0) 90%,
    rgba(0, 0, 0, 1) 94%,
    rgba(0, 0, 0, 1) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 42%,
    rgba(0, 0, 0, 0.85) 54%,
    rgba(0, 0, 0, 0.45) 68%,
    rgba(0, 0, 0, 0.08) 82%,
    rgba(0, 0, 0, 0) 90%,
    rgba(0, 0, 0, 1) 94%,
    rgba(0, 0, 0, 1) 100%
  );
  -webkit-mask-size: 100% 200%;
  mask-size: 100% 200%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: titleSoftBrushErase 7.2s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}

.title-char-green .title-char-glow-add {
  animation: titleGreenGlowPulse 6.5s cubic-bezier(0.42, 0, 0.58, 1) infinite alternate;
}

.title-char-purple .title-char-glow-add {
  animation: titlePurpleGlowPulse 6.2s cubic-bezier(0.42, 0, 0.58, 1) infinite alternate-reverse;
}

.title-char-body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  will-change: -webkit-mask-position, mask-position;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 48%,
    rgba(0, 0, 0, 0.88) 60%,
    rgba(0, 0, 0, 0.5) 74%,
    rgba(0, 0, 0, 0.12) 88%,
    rgba(0, 0, 0, 0) 95%,
    rgba(0, 0, 0, 1) 97%,
    rgba(0, 0, 0, 1) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 48%,
    rgba(0, 0, 0, 0.88) 60%,
    rgba(0, 0, 0, 0.5) 74%,
    rgba(0, 0, 0, 0.12) 88%,
    rgba(0, 0, 0, 0) 95%,
    rgba(0, 0, 0, 1) 97%,
    rgba(0, 0, 0, 1) 100%
  );
  -webkit-mask-size: 100% 200%;
  mask-size: 100% 200%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: titleSoftBrushErase 7.8s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}

/* Screen Edge Glow Vignettes */
.title-edge-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
  will-change: opacity, box-shadow;
}

.title-edge-green {
  box-shadow: inset 0 0 100px 30px rgba(16, 215, 130, 0.45),
              inset 0 0 180px 60px rgba(5, 160, 100, 0.25),
              inset 0 0 250px 90px rgba(2, 90, 55, 0.15);
  animation: titleEdgeGreen 20s cubic-bezier(0.4, 0, 0.2, 1) infinite,
             titleEdgeBreath 4.5s ease-in-out infinite alternate;
}

.title-edge-purple {
  box-shadow: inset 0 0 100px 30px rgba(220, 70, 245, 0.5),
              inset 0 0 180px 60px rgba(160, 40, 230, 0.3),
              inset 0 0 250px 90px rgba(90, 15, 140, 0.18);
  animation: titleEdgePurple 20s cubic-bezier(0.4, 0, 0.2, 1) infinite,
             titleEdgeBreath 4.5s ease-in-out infinite alternate;
}

/* Layer 6: Title Logo Graphic (Top, static, clean) */
.title-layer-logo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

.title-logo-body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ========================================================
   TITLE SCREEN UI & MENU NAVIGATION
======================================================== */
.title-content {
  position: relative;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(94%, 780px);
  max-width: 780px;
  padding: 16px 20px 18px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, rgba(14, 16, 26, 0.45) 0%, rgba(14, 16, 26, 0.82) 20%, rgba(10, 12, 20, 0.95) 100%);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(220, 70, 245, 0.15);
  animation: titleMenuFadeIn 1.2s ease-out 0.3s both;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s ease;
}

/* Patreon Community Link (Bottom Center of Title Screen) */
.title-patreon-link {
  position: relative;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 6px 16px 6px 10px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(26, 18, 28, 0.85) 0%, rgba(14, 16, 26, 0.9) 100%);
  border: 1px solid rgba(255, 66, 77, 0.45);
  border-radius: 20px;
  color: #ffb4b4;
  text-decoration: none;
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 14px rgba(255, 66, 77, 0.18);
  cursor: pointer;
  animation: titleMenuFadeIn 1.2s ease-out 0.45s both;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.title-patreon-link:hover {
  background: linear-gradient(135deg, rgba(48, 22, 34, 0.95) 0%, rgba(26, 18, 30, 0.95) 100%);
  border-color: #ff424d;
  color: #ffffff;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), 0 0 22px rgba(255, 66, 77, 0.55);
}

.title-patreon-link:active {
  transform: translateY(0) scale(0.98);
}

.title-patreon-link .patreon-logo-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(255, 66, 77, 0.4));
  transition: transform 0.25s ease;
  display: block;
}

.title-patreon-link:hover .patreon-logo-img {
  transform: rotate(10deg) scale(1.12);
  filter: drop-shadow(0 0 7px rgba(255, 66, 77, 0.8));
}

.title-patreon-link .patreon-text {
  line-height: 1;
  white-space: nowrap;
}

.menu-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.title-test-option {
  display: none !important;
}

/* Tester Mode Unlocked via - - + cheat code */
.title-content.show-test-options {
  width: min(96%, 960px);
  max-width: 960px;
  padding: 16px 24px 20px;
}

.title-content.show-test-options .menu-buttons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.title-content.show-test-options .title-test-option {
  display: flex !important;
  animation: testOptionPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes testOptionPopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 900px) {
  .title-content.show-test-options .menu-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .title-content {
    max-width: 94%;
    padding: 14px 14px 16px;
  }
  .menu-buttons {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.btn-menu {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
  width: 100%;
  background: linear-gradient(135deg, rgba(37, 40, 59, 0.85) 0%, rgba(26, 28, 42, 0.9) 100%);
  border: 1px solid rgba(62, 68, 99, 0.8);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-menu .icon {
  font-size: 1.25rem;
  width: 28px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.btn-menu .text-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  text-align: left;
}

.btn-menu .text-wrap > span:first-child {
  font-size: 0.92rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  width: 100%;
}

.btn-menu .sub-text {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  width: 100%;
  margin-top: 1px;
}

.btn-menu:hover {
  background: linear-gradient(135deg, rgba(51, 56, 82, 0.95) 0%, rgba(34, 38, 58, 0.95) 100%);
  border-color: var(--primary);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), 0 0 14px var(--panel-glow);
}

.btn-menu.hero-option {
  background: linear-gradient(135deg, rgba(55, 42, 20, 0.9) 0%, rgba(35, 30, 48, 0.92) 50%, rgba(23, 25, 38, 0.92) 100%);
  border-color: rgba(255, 209, 102, 0.7);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 209, 102, 0.25);
}

.btn-menu.hero-option .icon {
  color: var(--accent-gold);
  filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.8));
  animation: heroIconFloat 2.5s ease-in-out infinite alternate;
}

.btn-menu.hero-option span {
  color: #fff9ea;
}

.btn-menu.hero-option .sub-text {
  color: #e5cd9c;
}

.btn-menu.hero-option:hover {
  background: linear-gradient(135deg, rgba(78, 60, 25, 0.98) 0%, rgba(50, 40, 68, 0.98) 50%, rgba(32, 36, 56, 0.98) 100%);
  border-color: #ffd166;
  color: #ffffff;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.75), 0 0 22px rgba(255, 209, 102, 0.5);
}

.btn-menu.primary-option {
  border-color: rgba(255, 209, 102, 0.45);
}

.btn-menu.primary-option:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), 0 0 18px var(--accent-gold-glow);
}

.title-footer {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.85;
}

.title-footer a {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.title-footer a:hover {
  color: var(--accent-gold);
}

/* ========================================================
   KEYFRAME ANIMATIONS FOR TITLE SYSTEM
======================================================== */
/* 20-Second Continuous Cycle: 8s green -> 2s fade -> 8s purple -> 2s fade */
@keyframes titleCycleGreen {
  0% {
    opacity: 1;
    visibility: visible;
  }
  38% {
    opacity: 1;
    visibility: visible;
  }
  48% {
    opacity: 0;
    visibility: hidden;
  }
  88% {
    opacity: 0;
    visibility: hidden;
  }
  98% {
    opacity: 1;
    visibility: visible;
  }
  100% {
    opacity: 1;
    visibility: visible;
  }
}

@keyframes titleCyclePurple {
  0% {
    opacity: 0;
    visibility: hidden;
  }
  38% {
    opacity: 0;
    visibility: hidden;
  }
  48% {
    opacity: 1;
    visibility: visible;
  }
  88% {
    opacity: 1;
    visibility: visible;
  }
  98% {
    opacity: 0;
    visibility: hidden;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

/* Ethereal Floating Motion for Goddess Characters */
@keyframes titleGoddessFloat {
  0% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-15px) scale(1.006);
  }
  100% {
    transform: translateY(3px) scale(0.997);
  }
}

/* Soft-Brush Bottom Half Dissolve & Restore */
@keyframes titleSoftBrushErase {
  0% {
    -webkit-mask-position: 0% 0%;
    mask-position: 0% 0%;
    opacity: 0.95;
  }
  50% {
    -webkit-mask-position: 0% 100%;
    mask-position: 0% 100%;
    opacity: 0.35;
  }
  100% {
    -webkit-mask-position: 0% 0%;
    mask-position: 0% 0%;
    opacity: 0.95;
  }
}

/* Additive Pulsating Glow: Green Goddess (Slow, Gradual & Ethereal) */
@keyframes titleGreenGlowPulse {
  0% {
    opacity: 0.18;
    filter: drop-shadow(0 0 16px rgba(78, 220, 120, 0.45))
            drop-shadow(0 0 35px rgba(40, 180, 90, 0.25))
            brightness(1.08);
  }
  50% {
    opacity: 0.50;
    filter: drop-shadow(0 0 25px rgba(90, 240, 140, 0.7))
            drop-shadow(0 0 52px rgba(50, 210, 110, 0.45))
            drop-shadow(0 0 85px rgba(25, 170, 75, 0.25))
            brightness(1.25);
  }
  100% {
    opacity: 0.82;
    filter: drop-shadow(0 0 35px rgba(110, 255, 160, 0.85))
            drop-shadow(0 0 70px rgba(65, 235, 125, 0.6))
            drop-shadow(0 0 105px rgba(35, 190, 85, 0.35))
            brightness(1.4);
  }
}

/* Additive Pulsating Glow: Purple Goddess (Slow, Gradual & Ethereal) */
@keyframes titlePurpleGlowPulse {
  0% {
    opacity: 0.18;
    filter: drop-shadow(0 0 16px rgba(220, 70, 240, 0.45))
            drop-shadow(0 0 35px rgba(160, 40, 200, 0.25))
            brightness(1.08);
  }
  50% {
    opacity: 0.50;
    filter: drop-shadow(0 0 25px rgba(240, 90, 255, 0.7))
            drop-shadow(0 0 52px rgba(190, 50, 220, 0.45))
            drop-shadow(0 0 85px rgba(140, 25, 170, 0.25))
            brightness(1.25);
  }
  100% {
    opacity: 0.82;
    filter: drop-shadow(0 0 35px rgba(255, 110, 255, 0.85))
            drop-shadow(0 0 70px rgba(215, 65, 235, 0.6))
            drop-shadow(0 0 105px rgba(160, 35, 190, 0.35))
            brightness(1.4);
  }
}

/* Edge Glow Transitions */
@keyframes titleEdgeGreen {
  0% {
    opacity: 0.9;
  }
  40% {
    opacity: 0.9;
  }
  50% {
    opacity: 0;
  }
  90% {
    opacity: 0;
  }
  100% {
    opacity: 0.9;
  }
}

@keyframes titleEdgePurple {
  0% {
    opacity: 0;
  }
  40% {
    opacity: 0;
  }
  50% {
    opacity: 0.95;
  }
  90% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@keyframes titleEdgeBreath {
  0% {
    filter: brightness(0.85);
  }
  100% {
    filter: brightness(1.3);
  }
}

@keyframes titleMenuFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.title-footer a:hover {
  color: var(--accent-gold);
}

/* ========================================================
   1A. PROLOGUE INTRO CUTSCENE SCREEN
======================================================== */
#prologue-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  overflow: hidden;
  display: none;
  opacity: 0;
  z-index: 60;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#prologue-screen.active {
  display: flex;
  opacity: 1;
}

.cutscene-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cutscene-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  will-change: opacity, transform;
  overflow: hidden;
}

.cutscene-layer.active {
  opacity: 1;
}

.cutscene-layer.fade-instant {
  transition: opacity 0.05s linear;
}

.cutscene-layer.fade-3s {
  transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cutscene-layer.fade-4s {
  transition: opacity 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cutscene-layer.fade-slow {
  transition: opacity 4.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.cutscene-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Layer specialized for vertical pan / tall images (scene/0/1.png) */
.cutscene-layer.scrolling-wrapper {
  display: block;
}

.cutscene-layer.scrolling-wrapper img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  min-height: 100%;
  object-fit: contain;
  object-position: top center;
  will-change: transform;
}

.cutscene-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.55) 90%),
              linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, transparent 15%, transparent 60%, rgba(0, 0, 0, 0.88) 100%);
  pointer-events: none;
  z-index: 5;
}

#cutscene-blackout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  opacity: 1;
  transition: opacity 2.5s ease-in-out;
  z-index: 20;
  pointer-events: none;
}

#cutscene-blackout.active {
  opacity: 1;
}

#cutscene-blackout.clear {
  opacity: 0;
}

#cutscene-blackout.fade-4s {
  transition: opacity 4s cubic-bezier(0.4, 0, 0.2, 1);
}

#cutscene-blackout.fade-slow {
  transition: opacity 4.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#cutscene-blackout.fade-instant {
  transition: opacity 0.05s linear;
}

.cutscene-dialogue-wrap {
  position: absolute;
  bottom: 40px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 30;
  padding: 0 40px;
  pointer-events: auto;
}

/* Cinematic subtitle format - NO box, NO borders, purely floating atmospheric medieval typography */
.cutscene-dialogue-card {
  max-width: 1100px;
  width: 100%;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  position: relative;
  transition: opacity 0.4s ease, transform 0.4s ease;
  cursor: pointer;
}

.cutscene-decor-top {
  display: none !important;
}

.cutscene-narrative-text {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 1.6rem;
  line-height: 1.65;
  color: #fff9eb;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.98), 
               0 0 20px rgba(0, 0, 0, 0.95), 
               0 0 35px rgba(0, 0, 0, 0.9), 
               0 0 12px rgba(255, 209, 102, 0.25);
  letter-spacing: 0.8px;
  min-height: 75px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  user-select: none;
}

.cutscene-narrative-text p {
  margin: 0;
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  animation: narrativeLineFadeIn 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes narrativeLineFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.cutscene-advance-row {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 4px;
  width: 100%;
}

.cutscene-advance-prompt {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.95rem;
  letter-spacing: 1.4px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 8px;
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.7), 0 2px 6px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.4s ease, color 0.3s ease;
}

.cutscene-advance-prompt.active {
  opacity: 1;
  animation: promptPulse 2.2s infinite ease-in-out;
}

.cutscene-advance-prompt.locked {
  opacity: 0;
  pointer-events: none;
}

@keyframes promptPulse {
  0%, 100% {
    opacity: 0.65;
    transform: translateX(0);
  }
  50% {
    opacity: 1;
    transform: translateX(4px);
  }
}

.btn-cutscene-skip {
  position: absolute;
  top: 22px;
  right: 26px;
  z-index: 40;
  background: rgba(14, 16, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 1px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.btn-cutscene-skip:hover {
  background: rgba(255, 209, 102, 0.2);
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.35);
  transform: translateY(-1px);
}

.story-top-controls {
  position: absolute;
  top: 22px;
  right: 26px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
}

.story-top-controls .btn-cutscene-skip {
  position: static;
  top: auto;
  right: auto;
}

.btn-cutscene-auto {
  background: rgba(14, 16, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 1px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.btn-cutscene-auto:hover {
  background: rgba(255, 209, 102, 0.2);
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.35);
  transform: translateY(-1px);
}

.btn-cutscene-auto.active {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.28) 0%, rgba(200, 140, 30, 0.4) 100%);
  border-color: var(--accent-gold, #ffd166);
  color: #ffd166;
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.45), inset 0 0 8px rgba(255, 209, 102, 0.25);
  font-weight: 600;
}

.btn-cutscene-auto .auto-badge-icon {
  font-size: 0.8rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.btn-cutscene-auto.active .auto-badge-icon {
  color: #ffd166;
  animation: promptPulse 1.5s infinite ease-in-out;
}

/* ========================================================
   1A-2. STORY VISUAL NOVEL SCENE SCREEN (SCENE 1: GATE)
======================================================== */
#story-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  overflow: hidden;
  display: none;
  opacity: 0;
  z-index: 65;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-screen.active {
  display: flex;
  opacity: 1;
}

#story-screen.map-overlay {
  background: transparent !important;
}

#story-screen.map-overlay .story-bg-layer {
  opacity: 0 !important;
  display: none !important;
}

#story-screen.map-overlay .story-vignette {
  opacity: 0.35;
}

.story-bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  pointer-events: none;
  z-index: 1;
}

.story-bg-layer.active {
  opacity: 1;
  z-index: 2;
}

.story-bg-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.story-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 45%, rgba(0, 0, 0, 0.5) 90%),
              linear-gradient(to bottom, rgba(0, 0, 0, 0.25) 0%, transparent 20%, transparent 60%, rgba(0, 0, 0, 0.85) 100%);
  pointer-events: none;
  z-index: 5;
}

.story-aligned-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.story-fullscreen-portrait {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), filter 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}

.story-fullscreen-portrait.active {
  opacity: 1;
}

.story-fullscreen-portrait.speaking {
  opacity: 1;
  filter: brightness(1) drop-shadow(0 0 25px rgba(255, 209, 102, 0.45));
  transform: scale(1.015);
  z-index: 12;
}

.story-fullscreen-portrait.dimmed {
  opacity: 1;
  filter: brightness(0.55) saturate(0.8);
  transform: scale(1);
  z-index: 10;
}

.story-fullscreen-portrait.dismissed {
  opacity: 0;
  filter: brightness(0.3);
  transform: scale(0.99);
}

.story-fullscreen-blink {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.1s ease-in-out !important;
  z-index: 13;
}

.story-fullscreen-blink.is-blinking {
  opacity: 1 !important;
}

.story-sprites-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.story-char-slot {
  position: absolute;
  bottom: 0;
  height: 92vh;
  max-height: 980px;
  width: auto;
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.45s ease;
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.story-char-slot img {
  height: 100%;
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  display: block;
}

.story-char-slot.left {
  left: 8vw;
  transform: translateX(-50px);
}

.story-char-slot.left.active {
  opacity: 1;
  transform: translateX(0);
}

.story-char-slot.left.speaking {
  opacity: 1;
  filter: brightness(1) drop-shadow(0 0 30px rgba(255, 209, 102, 0.5));
  transform: translateX(0) scale(1.025);
  z-index: 20;
}

.story-char-slot.left.dimmed {
  opacity: 0.9;
  filter: brightness(0.52) saturate(0.85);
  transform: translateX(0) scale(1);
  z-index: 15;
}

.story-char-slot.right {
  right: 8vw;
  transform: translateX(50px);
}

.story-char-slot.right.active {
  opacity: 1;
  transform: translateX(0);
}

.story-char-slot.right.speaking {
  opacity: 1;
  filter: brightness(1) drop-shadow(0 0 30px rgba(255, 209, 102, 0.5));
  transform: translateX(0) scale(1.025);
  z-index: 20;
}

.story-char-slot.right.dimmed {
  opacity: 0.9;
  filter: brightness(0.52) saturate(0.85);
  transform: translateX(0) scale(1);
  z-index: 15;
}

.story-char-slot.center {
  left: 50%;
  transform: translateX(-50%) translateY(30px);
}

.story-char-slot.center.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.story-char-slot.center.speaking {
  opacity: 1;
  filter: brightness(1) drop-shadow(0 0 30px rgba(255, 209, 102, 0.5));
  transform: translateX(-50%) scale(1.025);
  z-index: 20;
}

.story-char-slot.center.dimmed {
  opacity: 0.9;
  filter: brightness(0.52) saturate(0.85);
  transform: translateX(-50%) scale(1);
  z-index: 15;
}

.story-char-slot.dismissed {
  opacity: 0;
  filter: brightness(0.3);
}

.story-char-slot.left.dismissed {
  transform: translateX(-50px);
}

.story-char-slot.right.dismissed {
  transform: translateX(50px);
}

.story-shock-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 35;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.story-shock-canvas.active {
  opacity: 1;
}

#story-blackout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  opacity: 1;
  transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  pointer-events: none;
}

#story-blackout.active {
  opacity: 1;
}

#story-blackout.clear {
  opacity: 0;
}

#story-blackout.fade-1s {
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-blackout.fade-2s {
  transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-blackout.fade-3s {
  transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-blackout.fade-4s {
  transition: opacity 4s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-whiteout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  opacity: 0;
  transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 52;
  pointer-events: none;
}

#story-whiteout.active {
  opacity: 1;
}

#story-whiteout.clear {
  opacity: 0;
}

#story-whiteout.fade-1s {
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-whiteout.fade-2s {
  transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-whiteout.fade-3s {
  transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

#story-whiteout.fade-4s {
  transition: opacity 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-dialogue-wrap {
  position: absolute;
  bottom: 26px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 60;
  padding: 0 32px;
  pointer-events: auto;
  cursor: pointer;
}

.story-dialogue-box {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(20, 23, 36, var(--dialogue-bg-alpha, 0.7)) 0%, rgba(9, 11, 18, var(--dialogue-bg-alpha, 0.7)) 100%);
  border: 2px solid rgba(255, 209, 102, 0.65);
  border-radius: 12px;
  padding: 18px 28px 14px 28px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.92), 0 0 25px rgba(255, 209, 102, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(calc(14px * var(--dialogue-bg-alpha, 0.7)));
  -webkit-backdrop-filter: blur(calc(14px * var(--dialogue-bg-alpha, 0.7)));
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: background 0.25s ease, opacity 0.3s ease;
}

/* Circular Speaker Face Avatar for Visual Novel Story Scenes */
.story-speaker-face {
  position: absolute;
  top: -46px;
  left: 20px;
  z-index: 50;
  opacity: 0;
  transform: translateY(10px) scale(0.85);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.story-speaker-face.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.story-face-circle {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 3px solid var(--accent-gold, #ffd166);
  background: radial-gradient(circle at center, #2e2638 0%, #161826 70%, #0b0d16 100%);
  box-shadow: 0 0 0 2px rgba(12, 14, 22, 0.95), 
              0 8px 24px rgba(0, 0, 0, 0.9), 
              0 0 20px rgba(255, 209, 102, 0.45);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.story-face-circle::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.story-face-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  transform: scale(1.08);
  display: block;
}

.story-speaker-badge {
  align-self: flex-start;
  background: linear-gradient(135deg, #2b2314 0%, #1f1b29 100%);
  border: 1px solid var(--accent-gold);
  padding: 4px 16px;
  border-radius: 6px;
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-dialogue-box.has-face .story-speaker-badge {
  margin-left: 72px;
}

.story-speaker-badge.narration {
  display: none;
}

.story-dialogue-body {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 1.35rem;
  line-height: 1.7;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.7);
  min-height: 56px;
  user-select: none;
}

.story-dialogue-body p {
  margin: 0;
  animation: narrativeLineFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.story-advance-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.story-advance-icon {
  font-size: 1.1rem;
  color: var(--accent-gold);
  animation: promptPulse 1.8s infinite ease-in-out;
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.8);
  transition: opacity 0.2s ease, transform 0.2s ease;
  user-select: none;
}

.story-advance-icon.typing {
  opacity: 0;
  pointer-events: none;
}

.story-advance-icon.auto {
  font-size: 0.85rem;
  font-family: var(--font-title);
  letter-spacing: 1px;
  color: rgba(255, 209, 102, 0.9);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


/* ========================================================
   2. DUNGEON SCREEN
======================================================== */
#dungeon-screen {
  flex-direction: column;
  background-color: #0b0c11;
}

.dungeon-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  background: rgba(14, 16, 25, 0.88);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 50;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.map-badge {
  background: #23273a;
  border: 1px solid #3f4566;
  border-radius: 6px;
  padding: 4px 12px;
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--accent-gold);
}

.btn-nav {
  background: #222638;
  border: 1px solid #3c4363;
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-nav:hover {
  background: #2f354f;
  border-color: var(--primary);
  color: #ffffff;
}

.btn-nav.active {
  background: #1d3e3c;
  border-color: var(--primary);
  color: var(--primary);
}

.viewport-container {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #08080c;
  padding-top: 52px;
}

#dungeon-canvas {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9);
  border: 2px solid #2d324b;
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
  touch-action: none;
}

.test-only {
  display: none !important;
}

body.test-mode .test-only,
#dungeon-screen.test-mode .test-only,
#battle-screen.test-mode .test-only,
.test-mode .test-only {
  display: flex !important;
}

body.test-mode button.btn-card-action.test-only,
body.test-mode .btn-card-action.test-only {
  display: inline-flex !important;
}

.dungeon-hud {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: none !important;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
  pointer-events: none;
}

body.test-mode .dungeon-hud,
#dungeon-screen.test-mode .dungeon-hud {
  display: flex !important;
}

.hud-panel {
  background: rgba(18, 20, 31, 0.85);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.hud-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.hud-val {
  color: var(--accent-gold);
}

.controls-hint {
  display: none !important;
}

.key-badge {
  display: inline-block;
  background: #2b3046;
  border: 1px solid #4a5277;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: #ffffff;
  margin: 0 2px;
}

/* ========================================================
   3. PMAP (CITY VISUAL NOVEL SCREEN)
======================================================== */
#pmap-screen {
  flex-direction: column;
  background-color: #0b0c11;
}

.pmap-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  background: rgba(14, 16, 25, 0.9);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 50;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.pmap-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.pmap-viewport {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #08080c;
  padding-top: 52px;
}

.pmap-stage {
  position: relative;
  display: inline-block;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.95);
  border: 2px solid #333852;
  border-radius: 6px;
  overflow: hidden;
}

#pmap-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 75px);
  object-fit: contain;
  transition: transform 0.4s ease;
  user-select: none;
  -webkit-user-drag: none;
}

/* PMap Living Atmosphere & Water Canvases */
.pmap-water-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.pmap-atmosphere-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

#pmap-pins-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

/* PMap Interactive Location Pins */
.location-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  cursor: pointer;
  pointer-events: auto;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  --pin-color: #ffd166;
  --pin-glow: rgba(255, 209, 102, 0.65);
  --pin-halo: rgba(255, 209, 102, 0.9);
  --pin-halo-subtle: rgba(255, 209, 102, 0.3);
}

.location-pin:hover {
  transform: translate(-50%, -115%) scale(1.1);
  z-index: 40;
}

/* Flashing Halo Rings (Looping Waves) */
.pin-halo {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

.pin-halo::before,
.pin-halo::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--pin-halo);
  box-shadow: 0 0 16px var(--pin-halo), inset 0 0 8px var(--pin-halo-subtle);
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  animation: pmapHaloRadiate 2.4s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
}

.pin-halo::after {
  animation-delay: 1.2s;
}

.pin-icon-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  background: radial-gradient(circle, #2a2e45 0%, #161824 100%);
  border: 2px solid var(--pin-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8), 0 0 14px var(--pin-glow);
  animation: pmapPinFlash 2.4s infinite ease-in-out;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
  z-index: 2;
}

.location-pin:hover .pin-icon-wrap {
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.95), 0 0 28px var(--pin-halo), 0 0 45px var(--pin-glow);
  border-color: #ffffff;
}

.location-pin:hover .pin-halo::before,
.location-pin:hover .pin-halo::after {
  animation-duration: 1.6s;
}

.location-pin:hover .pin-halo::after {
  animation-delay: 0.8s;
}

.pin-icon-wrap::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--pin-color);
  transition: border-top-color 0.25s ease;
}

/* Locked & Greyed Out PMap Pins (Solid, Clearly Visible & Desaturated) */
.location-pin.locked {
  filter: grayscale(1) brightness(0.82) contrast(1.05) !important;
  opacity: 0.92 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  transform: translate(-50%, -100%) !important;
  --pin-color: #64748b !important;
  --pin-glow: transparent !important;
  --pin-halo: transparent !important;
}

.location-pin.locked .pin-halo::before,
.location-pin.locked .pin-halo::after {
  display: none !important;
  animation: none !important;
}

.location-pin.locked .pin-icon-wrap {
  animation: none !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.85) !important;
  border-color: #64748b !important;
  background: radial-gradient(circle, #252838 0%, #13151f 100%) !important;
  color: #94a3b8 !important;
}

.location-pin.locked .pin-icon-wrap::after {
  border-top-color: #64748b !important;
}

.location-pin.locked .pin-label {
  color: #94a3b8 !important;
  border-color: #475569 !important;
  background: rgba(15, 18, 28, 0.95) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8) !important;
}

/* Custom SVG Icons */
.icon-fishing-rod {
  display: inline-block;
  vertical-align: middle;
  width: 1.25em;
  height: 1.25em;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.6));
}

.pin-icon-wrap .icon-fishing-rod {
  width: 25px;
  height: 25px;
}

.location-scene-header .icon-fishing-rod {
  width: 28px;
  height: 28px;
}

.icon-holy-cross {
  display: inline-block;
  vertical-align: middle;
  width: 1.25em;
  height: 1.25em;
  filter: drop-shadow(0 0 5px rgba(216, 180, 254, 0.8));
}

.pin-icon-wrap .icon-holy-cross {
  width: 24px;
  height: 24px;
}

.location-scene-header .icon-holy-cross {
  width: 28px;
  height: 28px;
}

/* Specific Location Types & Halo Color Palettes */
.location-pin.castle {
  --pin-color: #ffd166;
  --pin-glow: rgba(255, 209, 102, 0.7);
  --pin-halo: rgba(255, 209, 102, 0.95);
  --pin-halo-subtle: rgba(255, 209, 102, 0.35);
}

.location-pin.guild,
.location-pin.plaza {
  --pin-color: #4ecdc4;
  --pin-glow: rgba(78, 205, 196, 0.7);
  --pin-halo: rgba(78, 205, 196, 0.95);
  --pin-halo-subtle: rgba(78, 205, 196, 0.35);
}

.location-pin.church {
  --pin-color: #c084fc;
  --pin-glow: rgba(192, 132, 252, 0.75);
  --pin-halo: rgba(216, 180, 254, 0.95);
  --pin-halo-subtle: rgba(192, 132, 252, 0.4);
}

.location-pin.weapon {
  --pin-color: #f87171;
  --pin-glow: rgba(248, 113, 113, 0.7);
  --pin-halo: rgba(248, 113, 113, 0.95);
  --pin-halo-subtle: rgba(248, 113, 113, 0.35);
}

.location-pin.item {
  --pin-color: #34d399;
  --pin-glow: rgba(52, 211, 153, 0.7);
  --pin-halo: rgba(52, 211, 153, 0.95);
  --pin-halo-subtle: rgba(52, 211, 153, 0.35);
}

.location-pin.tavern {
  --pin-color: #fb923c;
  --pin-glow: rgba(251, 146, 60, 0.7);
  --pin-halo: rgba(251, 146, 60, 0.95);
  --pin-halo-subtle: rgba(251, 146, 60, 0.35);
}

.location-pin.river {
  --pin-color: #06d6a0;
  --pin-glow: rgba(6, 214, 160, 0.7);
  --pin-halo: rgba(6, 214, 160, 0.95);
  --pin-halo-subtle: rgba(6, 214, 160, 0.35);
}

.location-pin.dungeon {
  --pin-color: #ef233c;
  --pin-glow: rgba(239, 35, 60, 0.8);
  --pin-halo: rgba(255, 75, 92, 0.98);
  --pin-halo-subtle: rgba(239, 35, 60, 0.45);
}

.pin-label {
  margin-top: 6px;
  background: rgba(14, 16, 26, 0.92);
  border: 1px solid var(--panel-border);
  color: #ffffff;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 2;
}

/* Keyframes for Continuous Looped Halo & Core Flash */
@keyframes pmapHaloRadiate {
  0% {
    transform: scale(0.85);
    opacity: 0.95;
    box-shadow: 0 0 12px var(--pin-halo), inset 0 0 6px var(--pin-halo);
  }
  40% {
    opacity: 0.8;
  }
  100% {
    transform: scale(2.05);
    opacity: 0;
    box-shadow: 0 0 28px var(--pin-halo-subtle), inset 0 0 14px transparent;
    border-width: 1px;
  }
}

@keyframes pmapPinFlash {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8), 0 0 12px var(--pin-glow);
    border-color: var(--pin-color);
  }
  50% {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9), 0 0 26px var(--pin-halo), 0 0 45px var(--pin-glow);
    border-color: #ffffff;
  }
}

/* ========================================================
   4. VISUAL NOVEL RPG DIALOGUE BOX
======================================================== */
.vn-dialogue-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 10, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 40px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.vn-dialogue-overlay.open {
  display: flex;
  opacity: 1;
}

.vn-dialogue-box {
  position: relative;
  width: 860px;
  max-width: 90vw;
  background: linear-gradient(180deg, rgba(24, 27, 43, var(--dialogue-bg-alpha, 0.7)) 0%, rgba(13, 15, 24, var(--dialogue-bg-alpha, 0.7)) 100%);
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  padding: 24px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 209, 102, 0.2);
  backdrop-filter: blur(calc(14px * var(--dialogue-bg-alpha, 0.7)));
  -webkit-backdrop-filter: blur(calc(14px * var(--dialogue-bg-alpha, 0.7)));
  display: flex;
  gap: 24px;
  transition: background 0.25s ease;
}

.vn-avatar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.vn-avatar-frame {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  border: 2px solid var(--primary);
  background: #11131c;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.8rem;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.vn-speaker-tag {
  background: #24283c;
  border: 1px solid var(--panel-border);
  padding: 3px 10px;
  border-radius: 4px;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  text-align: center;
}

.vn-content-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.vn-location-name {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 1px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vn-message-text {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.5;
  color: #ffffff;
  min-height: 55px;
  white-space: pre-line;
}

.vn-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
}

.vn-btn {
  background: #2a2e45;
  border: 1px solid #484f73;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.vn-btn:hover {
  background: #383d5c;
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.vn-btn.primary {
  background: var(--primary);
  border-color: #6ee7b7;
  color: #0b1118;
}

.vn-btn.primary:hover {
  background: #38b2ac;
  box-shadow: 0 0 15px var(--panel-glow);
}

/* ========================================================
   4B. DUNGEON NPC DIALOGUE & INTERACTION STYLES
======================================================== */
.dungeon-dialogue-box {
  border: 2px solid rgba(255, 77, 109, 0.75);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 35px rgba(255, 77, 109, 0.25);
  animation: slideUpDialogue 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpDialogue {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dungeon-avatar-frame {
  border-color: #ff4d6d !important;
  background: radial-gradient(circle at center, #2b1122 0%, #11131c 100%) !important;
  box-shadow: 0 0 20px rgba(255, 77, 109, 0.4) !important;
}

.dungeon-dialogue-avatar-icon {
  font-size: 2.8rem;
  filter: drop-shadow(0 0 8px rgba(255, 77, 109, 0.8));
}

.dungeon-dialogue-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 8px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(255, 77, 109, 0.45));
  transition: transform 0.25s ease;
}

.dungeon-avatar-frame:hover .dungeon-dialogue-avatar-img {
  transform: scale(1.06);
}

.dungeon-choice-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.battle-launch-btn {
  background: linear-gradient(135deg, #e63946 0%, #d62828 100%) !important;
  border-color: #ff758f !important;
  color: #ffffff !important;
  box-shadow: 0 4px 15px rgba(230, 57, 70, 0.5);
  padding: 10px 22px !important;
  font-size: 0.95rem !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: battleBtnPulse 2s infinite ease-in-out;
}

.battle-launch-btn:hover {
  background: linear-gradient(135deg, #ff4d6d 0%, #e63946 100%) !important;
  box-shadow: 0 0 22px rgba(255, 77, 109, 0.8) !important;
  transform: translateY(-2px);
}

@keyframes battleBtnPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(230, 57, 70, 0.5); }
  50% { box-shadow: 0 0 25px rgba(255, 77, 109, 0.85); }
}

.dialogue-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #a0aec0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.dialogue-close-btn:hover {
  background: rgba(255, 77, 109, 0.3);
  border-color: #ff4d6d;
  color: #ffffff;
}

/* ========================================================
   4C. RPG BATTLE ENCOUNTER TRANSITION & OBJECTIVE BANNER
======================================================== */
.rpg-battle-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  pointer-events: none;
  overflow: hidden;
  display: none;
}

.rpg-flash-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  will-change: opacity;
}

.rpg-black-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  will-change: opacity;
}

/* Battle Objective Banner ("Defeat Alys") */
.battle-objective-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: objectiveEntrance 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.battle-objective-banner.fade-out {
  animation: objectiveExit 0.55s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards !important;
}

.objective-banner-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(38, 12, 22, 0.95) 0%, rgba(18, 20, 32, 0.98) 50%, rgba(48, 10, 22, 0.95) 100%);
  border: 2px solid #ff4d6d;
  border-top-color: #ffd166;
  border-bottom-color: #e63946;
  padding: 8px 30px;
  border-radius: 40px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85), 0 0 25px rgba(255, 77, 109, 0.6), inset 0 0 15px rgba(255, 209, 102, 0.25);
  backdrop-filter: blur(8px);
}

.objective-banner-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(255, 77, 109, 0.9));
  animation: iconPulse 1.2s infinite alternate ease-in-out;
}

.objective-banner-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.objective-banner-sub {
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffd166;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(255, 209, 102, 0.6);
}

.objective-banner-main {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 77, 109, 0.9), 0 2px 4px rgba(0, 0, 0, 0.9);
}

@keyframes objectiveEntrance {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px) scale(0.85);
  }
  70% {
    opacity: 1;
    transform: translateX(-50%) translateY(4px) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes objectiveExit {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-35px) scale(0.9);
  }
}

@keyframes iconPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(255, 77, 109, 0.6)); }
  100% { transform: scale(1.2); filter: drop-shadow(0 0 14px rgba(255, 209, 102, 0.95)); }
}

/* ========================================================
   FIRE EMBLEM TURN PHASE SPLASH BANNER (TOP SLIDE ACROSS)
======================================================== */
.battle-fe-phase-banner {
  position: absolute;
  top: 18px;
  left: 0;
  width: 100%;
  height: 62px;
  pointer-events: none;
  z-index: 150;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.battle-fe-phase-banner.active {
  opacity: 1;
}

.battle-fe-phase-banner.active .fe-phase-ribbon {
  animation: fePhaseGlideAcross 1.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fePhaseGlideAcross {
  0% {
    transform: translate3d(-100vw, 0, 0) scale(0.92);
    opacity: 0;
  }
  16% {
    transform: translate3d(-10px, 0, 0) scale(1.02);
    opacity: 1;
  }
  30% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  68% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  84% {
    transform: translate3d(10px, 0, 0) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: translate3d(100vw, 0, 0) scale(0.92);
    opacity: 0;
  }
}

.fe-phase-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px 36px 6px 14px;
  border-radius: 40px;
  position: relative;
  will-change: transform, opacity;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.75);
  backface-visibility: hidden;
}

/* Player Phase (Fire Emblem Azure / Sapphire Theme) */
.battle-fe-phase-banner.player-phase .fe-phase-ribbon {
  background: linear-gradient(90deg, rgba(10, 25, 60, 0.96) 0%, rgba(13, 71, 161, 0.94) 40%, rgba(33, 150, 243, 0.9) 85%, transparent 100%);
  border-top: 2px solid #64b5f6;
  border-bottom: 2px solid #1976d2;
  border-left: 3px solid #90caf9;
  box-shadow: 0 0 30px rgba(33, 150, 243, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.battle-fe-phase-banner.player-phase .fe-phase-label {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(33, 150, 243, 0.95), 0 2px 5px rgba(0, 0, 0, 0.9);
  font-family: var(--font-title, 'Cinzel', 'Trajan Pro', serif);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 2.5px;
  font-style: italic;
  white-space: nowrap;
}

.battle-fe-phase-banner.player-phase .fe-phase-avatar-frame {
  border-color: #64b5f6;
  box-shadow: 0 0 18px rgba(33, 150, 243, 0.85);
}

/* Enemy Phase (Fire Emblem Crimson / Ruby Theme) */
.battle-fe-phase-banner.enemy-phase .fe-phase-ribbon {
  background: linear-gradient(90deg, rgba(50, 10, 25, 0.96) 0%, rgba(183, 28, 28, 0.94) 40%, rgba(244, 67, 54, 0.9) 85%, transparent 100%);
  border-top: 2px solid #ff7961;
  border-bottom: 2px solid #ba000d;
  border-left: 3px solid #ff8a80;
  box-shadow: 0 0 30px rgba(244, 67, 54, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.battle-fe-phase-banner.enemy-phase .fe-phase-label {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(244, 67, 54, 0.95), 0 2px 5px rgba(0, 0, 0, 0.9);
  font-family: var(--font-title, 'Cinzel', 'Trajan Pro', serif);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 2.5px;
  font-style: italic;
  white-space: nowrap;
}

.battle-fe-phase-banner.enemy-phase .fe-phase-avatar-frame {
  border-color: #ff5252;
  box-shadow: 0 0 18px rgba(244, 67, 54, 0.85);
}

/* Character Avatar Frame */
.fe-phase-avatar-frame {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #ffd166;
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fe-phase-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.fe-phase-flare {
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}

/* ========================================================
   LEFT TURN ORDER TIMELINE QUEUE
======================================================== */
.battle-turn-order-sidebar {
  width: 190px;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
}

.turn-order-panel {
  background: rgba(20, 22, 34, 0.85);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.turn-order-round {
  margin-left: auto;
  font-size: 0.65rem;
  font-family: var(--font-pixel, monospace);
  background: rgba(255, 209, 102, 0.15);
  color: var(--accent-gold, #ffd166);
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid rgba(255, 209, 102, 0.3);
}

.turn-order-track-wrap {
  flex: 1;
  padding: 12px 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.turn-order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

/* Turn Card Item */
.turn-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(28, 31, 48, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.35s ease, background 0.3s ease, border-color 0.3s ease;
  position: relative;
  will-change: transform, opacity;
}

.turn-card.slide-up-exit {
  transform: translateY(-42px) scale(0.85);
  opacity: 0;
}

.turn-card.slide-in-entry {
  animation: turnCardEnter 0.35s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes turnCardEnter {
  0% {
    transform: translateY(30px) scale(0.9);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Active / Current Turn Card */
.turn-card.active {
  transform: scale(1.04);
  z-index: 2;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

.turn-card.player.active {
  background: linear-gradient(90deg, rgba(13, 71, 161, 0.85) 0%, rgba(21, 101, 192, 0.5) 100%);
  border: 1.5px solid #64b5f6;
  box-shadow: 0 0 16px rgba(33, 150, 243, 0.5);
}

.turn-card.enemy.active {
  background: linear-gradient(90deg, rgba(183, 28, 28, 0.85) 0%, rgba(216, 27, 96, 0.5) 100%);
  border: 1.5px solid #ff7961;
  box-shadow: 0 0 16px rgba(244, 67, 54, 0.5);
}

/* Avatar Frame */
.turn-card-avatar-frame {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
  background: #0b0d14;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s;
}

.turn-card.player.active .turn-card-avatar-frame {
  border-color: #64b5f6;
  box-shadow: 0 0 8px rgba(33, 150, 243, 0.8);
}

.turn-card.enemy.active .turn-card-avatar-frame {
  border-color: #ff5252;
  box-shadow: 0 0 8px rgba(244, 67, 54, 0.8);
}

.turn-card-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.turn-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.turn-card-role {
  font-family: var(--font-title, sans-serif);
  font-size: 0.75rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.turn-card-state-tag {
  font-size: 0.6rem;
  font-family: var(--font-pixel, monospace);
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.55);
}

.turn-card.active .turn-card-state-tag {
  color: #ffd166;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(255, 209, 102, 0.8);
}

/* ========================================================
   5. IN-GAME MAP COLLISION EDITOR MODAL / OVERLAY
======================================================== */
.editor-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 10, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.editor-modal-overlay.open {
  display: flex;
}

.editor-modal-window {
  width: 98vw;
  height: 96vh;
  max-width: 1920px;
  max-height: 1080px;
  background: #141622;
  border: 2px solid #3c4263;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

.editor-modal-header {
  height: 50px;
  background: #1c1e2e;
  border-bottom: 1px solid #2f344e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
}

.editor-modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #0f1019;
}

.editor-tools-sidebar {
  width: 260px;
  background: #181a28;
  border-right: 1px solid #2a2e45;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.editor-canvas-container {
  flex: 1;
  position: relative;
  overflow: auto;
  display: block;
  background: #0b0c13;
  padding: 30px;
  text-align: center;
}

#web-editor-canvas {
  margin: 0 auto;
  border: 1px solid #3a3f5f;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  cursor: crosshair;
  display: inline-block;
  vertical-align: top;
  transform-origin: top center;
  transition: transform 0.15s ease;
}

/* Toast notifications */
.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1d2030;
  border: 1px solid var(--accent-emerald);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(6, 214, 160, 0.3);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
}

/* ========================================================
   6. HUD STAT PILLS & BADGES
======================================================== */
.hud-stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1a1d2c;
  border: 1px solid var(--panel-border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.hud-stat-pill.gold {
  border-color: rgba(255, 209, 102, 0.35);
  color: var(--accent-gold);
}

.hud-stat-pill.corruption {
  background: linear-gradient(135deg, rgba(30, 20, 48, 0.95) 0%, rgba(18, 12, 30, 0.98) 100%);
  border-color: rgba(192, 132, 252, 0.55);
  color: #d8b4fe;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.25), 0 0 6px rgba(192, 132, 252, 0.15);
  transition: all 0.3s ease;
}

.hud-stat-pill.corruption:hover {
  border-color: #c084fc;
  box-shadow: 0 0 14px rgba(192, 132, 252, 0.5);
}

.hud-stat-pill.corruption .player-corruption-display {
  color: #f472b6;
  font-weight: 800;
}

.gold-icon-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

.gold-icon-inline {
  width: 32px;
  height: 32px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
  margin-right: 4px;
}

.hud-stat-pill.hp {
  border-color: rgba(239, 35, 60, 0.35);
  color: #ff6b81;
}

.hud-stat-pill.mp {
  border-color: rgba(78, 205, 196, 0.35);
  color: #4ecdc4;
}

.hud-stat-pill.status {
  border-color: rgba(6, 214, 160, 0.35);
  color: var(--accent-emerald);
}

.hud-stat-pill.status.afflicted {
  border-color: var(--accent-crimson);
  color: var(--accent-crimson);
  animation: pulseAffliction 1.5s infinite;
}

@keyframes pulseAffliction {
  0%, 100% { box-shadow: 0 0 5px rgba(239, 35, 60, 0.4); }
  50% { box-shadow: 0 0 14px rgba(239, 35, 60, 0.8); }
}

/* ========================================================
   7. LOCATION SCREEN (1920x1081 STAGE & OVERLAYS)
======================================================== */
#location-screen {
  flex-direction: column;
  background-color: #07080d;
}

.location-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  background: rgba(12, 14, 22, 0.92);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 60;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.location-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #252a3f 0%, #171a28 100%);
  border: 1px solid var(--accent-gold);
  border-radius: 6px;
  padding: 5px 14px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px var(--accent-gold-glow);
}

.location-viewport {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #06070a;
  padding-top: 52px;
}

.location-stage-wrapper {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.location-stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: calc((100vh - 52px) * (1920 / 1081));
  max-height: calc(100vh - 52px);
  aspect-ratio: 1920 / 1081;
  background: #0a0b12;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

.location-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.location-bg {
  z-index: 1;
}

.rift-highlight-aura {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
  filter: blur(14px) saturate(220%) brightness(1.3);
  opacity: 0;
  display: none;
  transition: opacity 0.4s ease;
}

.rift-highlight-aura.active {
  display: block !important;
  opacity: 0.85;
  animation: riftAuraPulse 3.5s ease-in-out infinite alternate;
}

.rift-highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: plus-lighter;
  opacity: 0;
  display: none;
  transition: opacity 0.4s ease;
}

.rift-highlight-layer.active {
  display: block !important;
  opacity: 0.95;
  animation: riftGlowBreathe 3.5s ease-in-out infinite alternate;
}

@keyframes riftGlowBreathe {
  0% {
    opacity: 0.55;
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(199, 125, 255, 0.7));
  }
  50% {
    opacity: 0.98;
    filter: brightness(1.6) drop-shadow(0 0 25px rgba(224, 170, 255, 0.95)) drop-shadow(0 0 45px rgba(157, 78, 221, 0.8));
  }
  100% {
    opacity: 0.65;
    filter: brightness(1.3) drop-shadow(0 0 15px rgba(199, 125, 255, 0.75));
  }
}

@keyframes riftAuraPulse {
  0% {
    opacity: 0.45;
    transform: scale(0.996);
  }
  50% {
    opacity: 0.88;
    transform: scale(1.008);
  }
  100% {
    opacity: 0.55;
    transform: scale(0.998);
  }
}

.rift-atmosphere-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 3;
}

.location-portrait-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  animation: portraitSubtleBreathe 5s ease-in-out infinite;
  transform-origin: center bottom;
}

.location-portrait {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.location-portrait-blink {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-in-out;
  z-index: 4;
}

.location-portrait-blink.is-blinking {
  opacity: 1 !important;
}

.location-ambient-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 40%, rgba(0,0,0,0) 50%, rgba(5,6,10,0.55) 100%);
  pointer-events: none;
  z-index: 4;
}

@keyframes portraitSubtleBreathe {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-2.5px); }
}

/* Floating Visual Novel Dialogue & Control Card */
.location-dialogue-wrap {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  max-width: calc(100vw - 40px);
  z-index: 40;
}

.location-dialogue-card {
  background: linear-gradient(180deg, rgba(22, 25, 40, var(--dialogue-bg-alpha, 0.7)) 0%, rgba(13, 15, 25, var(--dialogue-bg-alpha, 0.7)) 100%);
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  padding: 18px 24px;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.9), 0 0 25px rgba(255, 209, 102, 0.15);
  backdrop-filter: blur(calc(10px * var(--dialogue-bg-alpha, 0.7)));
  -webkit-backdrop-filter: blur(calc(10px * var(--dialogue-bg-alpha, 0.7)));
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background 0.25s ease;
}

.loc-speaker-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.speaker-tag {
  background: linear-gradient(135deg, #323752 0%, #1e2133 100%);
  border: 1px solid var(--accent-gold);
  padding: 4px 14px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
}

.location-tag {
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  opacity: 0.9;
}

.loc-dialogue-body {
  min-height: 48px;
  font-size: 1rem;
  line-height: 1.5;
  color: #f3f4f6;
}

.loc-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.loc-action-btn {
  background: linear-gradient(135deg, #2c314b 0%, #1d2033 100%);
  border: 1px solid #4a5178;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.loc-action-btn:hover {
  background: linear-gradient(135deg, #3c4366 0%, #292d47 100%);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 12px var(--accent-gold-glow);
}

.loc-action-btn.primary {
  background: linear-gradient(135deg, #4ecdc4 0%, #319795 100%);
  border-color: #81e6d9;
  color: #0b1219;
}

.loc-action-btn.primary:hover {
  background: linear-gradient(135deg, #5fe3da 0%, #38b2ac 100%);
  color: #05080c;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 15px var(--panel-glow);
}

/* ========================================================
   8. FACILITY OVERLAY & SHOP/QUEST PANELS
======================================================== */
.facility-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 10, 16, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 70;
  padding: 20px;
}

.facility-overlay.open {
  display: flex;
  animation: facilityFadeIn 0.25s ease;
}

@keyframes facilityFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.facility-window {
  width: 960px;
  max-width: 95vw;
  height: 82vh;
  background: #141624;
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95), 0 0 30px rgba(255, 209, 102, 0.15);
  overflow: hidden;
}

.facility-header {
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  background: #1b1e2f;
  border-bottom: 1px solid #2f354f;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.facility-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.facility-icon {
  font-size: 1.5rem;
}

.facility-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.facility-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.facility-tab-btn {
  background: #24293e;
  border: 1px solid #3d4566;
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.facility-tab-btn:hover {
  background: #2f3652;
  color: #ffffff;
}

.facility-tab-btn.active {
  background: var(--primary);
  border-color: #81e6d9;
  color: #0a1118;
  box-shadow: 0 0 12px var(--panel-glow);
}

.facility-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #0f111c;
}

/* Custom Scrollbar */
.facility-body::-webkit-scrollbar,
.custom-modal-body::-webkit-scrollbar {
  width: 8px;
}

.facility-body::-webkit-scrollbar-track,
.custom-modal-body::-webkit-scrollbar-track {
  background: #0a0b12;
}

.facility-body::-webkit-scrollbar-thumb,
.custom-modal-body::-webkit-scrollbar-thumb {
  background: #2b3149;
  border-radius: 4px;
}

/* ========================================================
   9. SHOP / BLACKSMITH / CHURCH / QUEST ITEM CARDS
======================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.item-card {
  background: linear-gradient(135deg, #1a1d2d 0%, #141624 100%);
  border: 1px solid #333852;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.item-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 209, 102, 0.15);
}

.item-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.item-card-icon {
  width: 48px;
  height: 48px;
  background: #10121d;
  border: 1px solid #3e4566;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.7rem;
  flex-shrink: 0;
}

.item-card-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.item-card-name {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.item-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.item-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.stat-chip {
  background: #23273c;
  border: 1px solid #3c4263;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--accent-gold);
}

.stat-diff-up {
  color: var(--accent-emerald);
}

.stat-diff-down {
  color: var(--accent-crimson);
}

.item-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #23273b;
}

.price-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.stock-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-card-action {
  background: linear-gradient(135deg, #2b3049 0%, #1c2033 100%);
  border: 1px solid #485078;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-card-action:hover:not(:disabled) {
  background: var(--primary);
  border-color: #81e6d9;
  color: #0b1219;
  box-shadow: 0 0 10px var(--panel-glow);
}

.btn-card-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Quest Cards */
.quest-card {
  background: linear-gradient(135deg, #1c1f30 0%, #131522 100%);
  border: 1px solid #373e5c;
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s;
}

.quest-card:hover {
  border-color: var(--accent-gold);
}

.quest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quest-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quest-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.quest-status-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  letter-spacing: 0.5px;
}

.quest-status-badge.available {
  background: rgba(78, 205, 196, 0.2);
  border: 1px solid var(--primary);
  color: var(--primary);
}

.quest-status-badge.active {
  background: rgba(255, 209, 102, 0.2);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
}

.quest-status-badge.ready {
  background: rgba(6, 214, 160, 0.25);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  animation: pulseReady 1.5s infinite;
}

.quest-status-badge.completed {
  background: rgba(156, 163, 175, 0.2);
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
}

@keyframes pulseReady {
  0%, 100% { box-shadow: 0 0 5px rgba(6, 214, 160, 0.4); }
  50% { box-shadow: 0 0 15px rgba(6, 214, 160, 0.8); }
}

.quest-desc {
  font-size: 0.88rem;
  color: #d1d5db;
  line-height: 1.4;
}

.quest-objective-row {
  background: #11131e;
  border: 1px solid #292d42;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.quest-rewards-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.reward-item {
  color: var(--accent-gold);
  font-weight: 700;
}

/* Church Shrine / Purification */
.shrine-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
}

.shrine-card {
  background: linear-gradient(135deg, #1d2136 0%, #131625 100%);
  border: 1px solid #414a72;
  border-radius: 12px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.shrine-info {
  display: flex;
  gap: 16px;
  align-items: center;
}

.shrine-icon {
  font-size: 2.4rem;
  width: 60px;
  height: 60px;
  background: #10121d;
  border: 1px solid var(--primary);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 15px var(--panel-glow);
}

.shrine-details h4 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.shrine-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ailments-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ailment-tag {
  background: rgba(239, 35, 60, 0.15);
  border: 1px solid var(--accent-crimson);
  color: #ff6b81;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state .icon {
  font-size: 3rem;
  opacity: 0.6;
}

/* ========================================================
   9. INN & TAVERN FACILITY STYLES
======================================================== */
.inn-lodging-container {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.inn-lodging-card {
  background: linear-gradient(180deg, #1e2133 0%, #121422 100%);
  border: 2px solid #523e2b;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(251, 146, 60, 0.12);
  display: flex;
  flex-direction: column;
}

.inn-room-banner {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #090a10;
}

.inn-room-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  filter: brightness(0.9) contrast(1.05);
  transition: transform 0.6s ease;
}

.inn-lodging-card:hover .inn-room-preview-img {
  transform: scale(1.03);
}

.inn-room-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(18, 20, 32, 0.88);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}

.inn-room-details {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inn-room-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.inn-room-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.inn-room-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.price-tag.large {
  font-size: 1.15rem;
  padding: 6px 14px;
  background: rgba(255, 209, 102, 0.12);
  border-color: var(--accent-gold);
}

.inn-perks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.inn-perk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 16, 26, 0.75);
  border: 1px solid #2e344e;
  border-radius: 8px;
  padding: 10px 14px;
}

.inn-perk-item .perk-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.inn-perk-item .perk-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inn-perk-item .perk-info strong {
  font-size: 0.85rem;
  color: #f3f4f6;
  font-family: var(--font-title);
}

.inn-perk-item .perk-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.inn-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #10121d;
  border: 1px solid #282e46;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
}

.inn-status-bar .stat-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inn-action-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-card-action.btn-rent-room {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0c0f16;
  border-color: #fcd34d;
  font-size: 0.95rem;
  padding: 10px 24px;
  font-weight: 800;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.btn-card-action.btn-rent-room:hover:not(:disabled) {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
  transform: translateY(-2px);
}

/* Tavern Drinks & Ale Card */
.inn-ale-card {
  border-color: #634327;
  background: linear-gradient(135deg, #1f1b26 0%, #13141f 100%);
}

.inn-ale-card:hover {
  border-color: #fb923c;
}

.inn-drink-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inn-rumor-card {
  background: linear-gradient(135deg, #1b1e2c 0%, #12141e 100%);
  border-color: #3b4260;
}

.inn-rumor-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

/* Atmospheric Fullscreen Resting Cutscene */
.night-rest-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.night-rest-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.night-rest-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: brightness(0.22) blur(3px);
  transform: scale(1.05);
  animation: restBackdropZoom 2s ease forwards;
}

.night-rest-dimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(14, 16, 28, 0.88) 0%, rgba(5, 7, 12, 0.98) 100%);
}

.night-rest-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 620px;
  padding: 30px;
  animation: restContentFloat 1.8s ease forwards;
}

.night-rest-icon {
  font-size: 3.8rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(255, 209, 102, 0.6));
  animation: sleepZFloat 1.8s ease-in-out infinite;
}

.night-rest-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.4);
}

.night-rest-desc {
  font-size: 1.05rem;
  color: #cbd5e1;
  margin-bottom: 20px;
  line-height: 1.5;
}

.night-rest-stats-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.night-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  color: #ffffff;
  font-weight: 700;
}

.night-rest-morning-badge {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 1.5px;
  padding: 4px 16px;
  border-radius: 4px;
  background: rgba(255, 209, 102, 0.15);
  border: 1px solid var(--accent-gold);
}

@keyframes restBackdropZoom {
  from { transform: scale(1.0); }
  to { transform: scale(1.08); }
}

@keyframes restContentFloat {
  0% { opacity: 0; transform: translateY(20px); }
  25% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0.9; transform: translateY(-5px); }
}

@keyframes sleepZFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.05); }
}

/* ========================================================
   10. CUSTOM MODAL OVERLAYS (INVENTORY & SPELLBOOK)
======================================================== */
.custom-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 10, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.custom-modal-overlay.open {
  display: flex;
}

.custom-modal-window {
  width: 720px;
  max-width: 92vw;
  max-height: 85vh;
  background: #141624;
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

.custom-modal-window.large {
  width: 920px;
}

.custom-modal-header {
  height: 52px;
  background: #1b1e2f;
  border-bottom: 1px solid #2f354f;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
}

.custom-modal-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #0f111c;
}

.inventory-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .inventory-layout {
    grid-template-columns: 1fr;
  }
}

.player-stats-panel {
  background: #181b2b;
  border: 1px solid #333852;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-gold);
  border-bottom: 1px solid #2e334d;
  padding-bottom: 6px;
}

.equip-slot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #11131f;
  border: 1px solid #292d43;
  border-radius: 6px;
  padding: 8px 12px;
}

.equip-slot-label {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.equip-slot-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-item {
  background: #11131f;
  border: 1px solid #292d43;
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.stat-item .val {
  font-weight: 700;
  color: var(--accent-gold);
}

/* ========================================================
   FISHING MINIGAME SYSTEM & MODALS
======================================================== */
.fishing-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 6, 12, 0.88);
  backdrop-filter: blur(16px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100050;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fishing-modal-backdrop.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.fishing-card {
  width: 94vw;
  max-width: 960px;
  height: 88vh;
  max-height: 720px;
  background: rgba(12, 15, 28, 0.95);
  border: 1px solid rgba(78, 205, 196, 0.35);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(78, 205, 196, 0.2);
  overflow: hidden;
  position: relative;
}

/* Header HUD */
.fishing-header {
  height: 68px;
  padding: 0 20px;
  background: rgba(18, 22, 40, 0.95);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fishing-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fishing-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(78, 205, 196, 0.15);
  border: 1px solid var(--primary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.3rem;
}

.fishing-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
}

.fishing-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.fishing-scoreboard {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 12px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 85px;
}

.score-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-gold);
}

.score-value {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.btn-hud-small {
  background: rgba(78, 205, 196, 0.15);
  border: 1px solid rgba(78, 205, 196, 0.4);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-hud-small:hover {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

.btn-close-fishing {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-close-fishing:hover {
  background: rgba(239, 35, 60, 0.6);
  color: #fff;
  transform: rotate(90deg);
}

/* Fishing Viewport & River Scene */
.fishing-viewport {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #080f24;
  overflow: hidden;
}

.river-scene {
  flex: 1;
  position: relative;
  background-image: url('bg/river.png');
  background-size: cover;
  background-position: center;
  cursor: crosshair;
  overflow: hidden;
}

.scene-water {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

.water-ripples {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ripple-circle {
  position: absolute;
  border: 2px solid rgba(78, 205, 196, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: rippleExpand 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes rippleExpand {
  0% { width: 0; height: 0; opacity: 1; }
  100% { width: 140px; height: 70px; opacity: 0; }
}

/* Fishing Line & Bobber */
.fishing-line-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.line-svg {
  width: 100%;
  height: 100%;
  position: absolute;
}

.bobber {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: bobberFloat 2s ease-in-out infinite alternate;
}

@keyframes bobberFloat {
  0% { transform: translate(-50%, -50%) translateY(-3px); }
  100% { transform: translate(-50%, -50%) translateY(3px); }
}

.bobber.biting {
  animation: bobberDip 0.22s ease-in-out infinite alternate !important;
}

@keyframes bobberDip {
  0% { transform: translate(-50%, -50%) translateY(0); }
  100% { transform: translate(-50%, -50%) translateY(14px); }
}

.bobber-top {
  width: 14px;
  height: 8px;
  background: #ef233c;
  border-radius: 7px 7px 0 0;
  border: 1px solid #ffffff;
}

.bobber-bottom {
  width: 14px;
  height: 8px;
  background: #ffffff;
  border-radius: 0 0 7px 7px;
  border: 1px solid #d1d5db;
}

.bite-exclamation {
  display: none;
  position: absolute;
  top: -24px;
  font-size: 1.3rem;
  animation: pulseBite 0.35s infinite alternate;
  filter: drop-shadow(0 0 6px #ef233c);
}

.bobber.biting .bite-exclamation {
  display: block;
}

@keyframes pulseBite {
  0% { transform: scale(1); }
  100% { transform: scale(1.4); }
}

.caught-fish-water-popup {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  animation: waterPopBurst 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: none;
}

.water-popup-pixel-art {
  width: 130px;
  height: 130px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 25px rgba(255, 209, 102, 0.9));
}

@keyframes waterPopBurst {
  0% { transform: translate(-50%, 40px) scale(0.3) rotate(-15deg); opacity: 0; }
  60% { transform: translate(-50%, -60px) scale(1.25) rotate(8deg); opacity: 1; }
  100% { transform: translate(-50%, -30px) scale(1) rotate(0deg); opacity: 1; }
}

/* River Status Banner */
.fishing-status-banner {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 14, 21, 0.88);
  border: 1px solid rgba(78, 205, 196, 0.4);
  padding: 8px 22px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 10;
}

/* Celebration & Flash Alert Overlays */
.celebration-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  z-index: 40;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.25) 0%, rgba(0, 0, 0, 0) 75%);
}

.celebration-overlay.active {
  display: flex;
}

.celebration-text {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.9);
  animation: bounceZoom 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceZoom {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.flash-alert-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  z-index: 35;
  background: rgba(239, 35, 60, 0.25);
  animation: flashAlarm 0.4s infinite alternate;
}

.flash-alert-overlay.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 16px;
}

@keyframes flashAlarm {
  0% { background: rgba(239, 35, 60, 0.15); }
  100% { background: rgba(239, 35, 60, 0.38); }
}

.flash-banner {
  background: rgba(239, 35, 60, 0.95);
  border: 2px solid #fff;
  border-radius: 12px;
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 10px 35px rgba(239, 35, 60, 0.7);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 800;
}

.space-prompt-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

/* Reeling Dashboard */
.reeling-dashboard {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(13, 14, 21, 0.82) 0%, rgba(8, 9, 15, 0.98) 100%);
  border-top: 1px solid rgba(78, 205, 196, 0.3);
  display: flex;
  gap: 20px;
  align-items: center;
  z-index: 20;
}

.reeling-dashboard.strain-shake {
  animation: strainShake 0.08s infinite alternate;
}

@keyframes strainShake {
  0% { transform: translate(1px, 1px); }
  100% { transform: translate(-1px, -1px); }
}

.reeling-progress-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-label-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-title);
}

.progress-track-bg {
  position: relative;
  height: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #3b405d;
  border-radius: 10px;
  overflow: visible;
}

.progress-track-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent-emerald));
  border-radius: 9px;
  transition: width 0.05s linear;
}

.fish-track-icon {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  font-size: 1.15rem;
  filter: drop-shadow(0 0 5px var(--primary));
  transition: left 0.05s linear;
}

.net-goal-icon {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
}

.tension-meter-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tension-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-title);
}

.tension-safe {
  color: var(--accent-emerald);
}

.tension-warn {
  color: var(--accent-gold);
}

.tension-danger {
  color: var(--accent-crimson);
  font-weight: 900;
}

.tension-bar-bg {
  position: relative;
  height: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #3b405d;
  border-radius: 10px;
  overflow: hidden;
}

.tension-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-emerald) 0%, var(--accent-gold) 65%, var(--accent-crimson) 90%);
  border-radius: 9px;
  transition: width 0.05s linear;
}

.tension-bar-fill.critical {
  animation: strainShake 0.08s infinite alternate;
  background: var(--accent-crimson) !important;
}

.reeling-control-tip {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

/* ========================================================
   CATCH VICTORY MODAL & JOURNAL
======================================================== */
.catch-card {
  max-width: 480px;
  width: 90vw;
  background: rgba(18, 20, 32, 0.98);
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 209, 102, 0.25);
  animation: bounceZoom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.catch-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.new-highscore-badge {
  background: linear-gradient(90deg, #ff007f, #7928ca);
  color: #fff;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.catch-badge {
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  color: var(--accent-gold);
  letter-spacing: 2px;
}

.catch-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

.catch-img-frame {
  background: #090b14;
  border: 2px solid rgba(255, 209, 102, 0.4);
  border-radius: 12px;
  padding: 12px;
  margin: 14px auto;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.8);
}

.catch-img-pixel {
  max-width: 130px;
  max-height: 130px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.8));
}

.rarity-badge {
  position: absolute;
  bottom: 8px;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.rarity-badge.common { background: rgba(156, 163, 175, 0.3); color: #d1d5db; border: 1px solid #9ca3af; }
.rarity-badge.uncommon { background: rgba(6, 214, 160, 0.3); color: var(--accent-emerald); border: 1px solid var(--accent-emerald); }
.rarity-badge.rare { background: rgba(78, 205, 196, 0.3); color: var(--primary); border: 1px solid var(--primary); }
.rarity-badge.epic { background: rgba(255, 209, 102, 0.3); color: var(--accent-gold); border: 1px solid var(--accent-gold); }

.catch-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.catch-stat-box {
  background: #11131f;
  border: 1px solid #2e334d;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}

.catch-stat-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
  font-family: var(--font-title);
}

.catch-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-pixel);
  margin-top: 3px;
}

.gold-highlight {
  color: var(--accent-gold) !important;
}

.score-highlight {
  color: var(--primary) !important;
}

.catch-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Journal Modal */
.journal-card {
  max-width: 650px;
  width: 90vw;
  max-height: 82vh;
  background: rgba(18, 20, 32, 0.98);
  border: 1px solid rgba(78, 205, 196, 0.4);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.journal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2e334d;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.journal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.journal-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.journal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.journal-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 6px;
}

.journal-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #11131f;
  border: 1px solid #2e334d;
  border-radius: 10px;
  padding: 10px 14px;
}

.journal-img-box {
  width: 60px;
  height: 60px;
  background: #080a12;
  border: 1px solid #3b405d;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.journal-img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.journal-details {
  flex: 1;
}

.journal-name {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.journal-rarity {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}

.journal-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.journal-stats strong {
  color: var(--accent-gold);
}

.journal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}


/* ========================================================
   ANIMATION TEST SCREEN (DRAGON QUEST & RPG MAKER MV FX)
======================================================== */
#animtest-screen {
  flex-direction: column;
  background: radial-gradient(circle at center, #151624 0%, #090a10 100%);
  z-index: 30;
  overflow: hidden;
}

.animtest-header {
  height: 60px;
  background: rgba(14, 16, 26, 0.95);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  z-index: 25;
  flex-shrink: 0;
}

.animtest-title-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-shadow: 0 0 10px var(--accent-gold-glow);
}

.animtest-title-badge .badge-icon {
  font-size: 1.2rem;
  animation: pulse-icon 2s infinite ease-in-out;
}

.animtest-ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(22, 24, 36, 0.8);
  border: 1px solid var(--panel-border);
  padding: 4px 10px;
  border-radius: 8px;
}

.animtest-ctrl-group .ctrl-label {
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.animtest-select {
  background: transparent;
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.animtest-select option {
  background: var(--bg-card);
  color: #fff;
}

.animtest-speed-pills {
  display: flex;
  gap: 4px;
  background: rgba(22, 24, 36, 0.8);
  border: 1px solid var(--panel-border);
  padding: 3px;
  border-radius: 8px;
}

.btn-speed-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-speed-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-speed-pill.active {
  background: var(--primary);
  color: #000;
  font-weight: 700;
}

/* Main Container Layout */
.animtest-main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 20px;
  gap: 16px;
  overflow: hidden;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

/* Canvas Viewport */
.animtest-viewport {
  position: relative;
  flex: 1;
  min-height: 280px;
  background: #06070b;
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 8px 30px rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  cursor: crosshair;
}

#animtest-canvas {
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.animtest-canvas-hints {
  position: absolute;
  bottom: 10px;
  left: 14px;
  background: rgba(10, 12, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  pointer-events: none;
  backdrop-filter: blur(8px);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Scrubber & Playback HUD */
.animtest-hud-overlay {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.hud-playback-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 17, 27, 0.9);
  border: 1px solid var(--panel-border);
  padding: 6px 12px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.btn-hud-tool {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: #fff;
  font-size: 0.85rem;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-weight: 700;
}

.btn-hud-tool:hover {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

.hud-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.hud-checkbox-label input {
  cursor: pointer;
  accent-color: var(--primary);
}

.hud-status-info {
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding-left: 10px;
  display: flex;
  gap: 10px;
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  color: var(--text-muted);
}

.hud-status-info strong {
  color: var(--accent-gold);
}

/* Ability Deck / Animation Selection Cards */
.animtest-deck {
  background: rgba(18, 20, 32, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-gold);
  letter-spacing: 1px;
}

.btn-deck-special {
  background: linear-gradient(135deg, #d90429 0%, #ff5400 50%, #ffd166 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 18px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 84, 0, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-deck-special:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 28px rgba(255, 84, 0, 0.7);
}

.btn-deck-special .sub {
  font-size: 0.58rem;
  font-family: var(--font-body);
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deck-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.anim-card {
  background: rgba(26, 29, 45, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
  position: relative;
}

.anim-card:hover {
  background: rgba(32, 36, 56, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.anim-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.25);
  background: rgba(28, 33, 52, 0.95);
}

#card-anim-fire.active {
  border-color: #ff6b35;
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.35);
}

#card-anim-charm.active {
  border-color: #ff4d94;
  box-shadow: 0 0 20px rgba(255, 77, 148, 0.35);
}

#card-anim-slash.active {
  border-color: #00f0ff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.25rem;
  background: rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.card-icon.fire-glow {
  border: 1px solid #ff7700;
  box-shadow: 0 0 10px rgba(255, 119, 0, 0.4);
}

.card-icon.charm-glow {
  border: 1px solid #ff4d94;
  box-shadow: 0 0 10px rgba(255, 77, 148, 0.4);
}

.card-icon.slash-glow {
  border: 1px solid #00d2ff;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.card-title-wrap {
  display: flex;
  flex-direction: column;
}

.card-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
}

.card-subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.card-desc {
  font-size: 0.74rem;
  color: #a0aec0;
  line-height: 1.35;
  margin: 0;
}

.card-variants {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.btn-variant {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  font-weight: 600;
}

.btn-variant:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-variant.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 700;
  border-color: var(--accent-gold);
}

.btn-cast-action {
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  color: #fff;
}

.btn-cast-action.fire-btn {
  background: linear-gradient(135deg, #d00000 0%, #ff6b35 100%);
  box-shadow: 0 4px 12px rgba(208, 0, 0, 0.35);
}
.btn-cast-action.fire-btn:hover {
  background: linear-gradient(135deg, #e81b23 0%, #ff8c42 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 107, 53, 0.5);
}

.btn-cast-action.charm-btn {
  background: linear-gradient(135deg, #c71585 0%, #ff69b4 100%);
  box-shadow: 0 4px 12px rgba(199, 21, 133, 0.35);
}
.btn-cast-action.charm-btn:hover {
  background: linear-gradient(135deg, #db2777 0%, #ff85c0 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 105, 180, 0.5);
}

.btn-cast-action.slash-btn {
  background: linear-gradient(135deg, #0f4c81 0%, #00b4d8 100%);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.35);
}
.btn-cast-action.slash-btn:hover {
  background: linear-gradient(135deg, #1e6091 0%, #48cae4 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(72, 202, 228, 0.5);
}

.btn-cast-action .hotkey-badge {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-gold);
  border: 1px solid rgba(255, 209, 102, 0.3);
}

@media (max-width: 900px) {
  .deck-cards-grid {
    grid-template-columns: 1fr;
  }
  .animtest-header {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 8px;
  }
}

/* ========================================================
   TACTICAL BATTLE SCREEN (FIRE EMBLEM x DOFUS HYBRID)
======================================================== */
#battle-screen {
  flex-direction: column;
  background: radial-gradient(circle at 50% 20%, #151828 0%, #090a10 100%);
  overflow: hidden;
  height: 100%;
}

.battle-header {
  height: 56px;
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: rgba(14, 16, 26, 0.95);
  border-bottom: 1px solid rgba(255, 209, 102, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  z-index: 30;
}

.battle-header .header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.battle-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  background: rgba(255, 209, 102, 0.08);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 209, 102, 0.25);
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.phase-badge.player {
  background: linear-gradient(135deg, rgba(6, 214, 160, 0.2) 0%, rgba(78, 205, 196, 0.35) 100%);
  border: 1px solid var(--primary);
  color: #5eead4;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.phase-badge.enemy {
  background: linear-gradient(135deg, rgba(239, 35, 60, 0.2) 0%, rgba(199, 21, 133, 0.35) 100%);
  border: 1px solid var(--accent-crimson);
  color: #ff6b81;
  box-shadow: 0 0 15px rgba(239, 35, 60, 0.35);
  animation: pulse-enemy-badge 1.8s infinite;
}

@keyframes pulse-enemy-badge {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.9; }
}

.phase-badge .round-num {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 10px;
  color: #fff;
}

/* Battle Main Layout */
.battle-main-layout {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 12px 18px;
  overflow: hidden;
  height: calc(100% - 56px);
}

.battle-arena-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 100%;
}

/* Tactical Status Top Strip */
.battle-status-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 816px;
}

.unit-status-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(22, 24, 36, 0.85);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.unit-status-card.player {
  border-left: 3px solid var(--primary);
}

.unit-status-card.enemy {
  border-right: 3px solid var(--accent-crimson);
  flex-direction: row-reverse;
  text-align: right;
}

.unit-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: #0b0d14;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.unit-card-avatar.player {
  border-color: #64b5f6;
  box-shadow: 0 0 10px rgba(33, 150, 243, 0.45);
}

.unit-card-avatar.enemy {
  border-color: #ff5252;
  box-shadow: 0 0 10px rgba(244, 67, 54, 0.45);
}

.unit-card-face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.unit-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.unit-card-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.unit-status-card.enemy .unit-card-name-row {
  flex-direction: row-reverse;
}

.unit-card-name-row .unit-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
}

.unit-buffs-list {
  display: flex;
  gap: 4px;
}

.buff-pill {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.buff-pill.buff {
  background: rgba(255, 209, 102, 0.2);
  color: var(--accent-gold);
  border: 1px solid rgba(255, 209, 102, 0.4);
}

.buff-pill.debuff {
  background: rgba(239, 35, 60, 0.2);
  color: #ff6b81;
  border: 1px solid rgba(239, 35, 60, 0.4);
  animation: pulse-debuff 1.5s infinite;
}

@keyframes pulse-debuff {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.cooldown-tag {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.cooldown-tag.ready {
  background: rgba(6, 214, 160, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(6, 214, 160, 0.4);
}

.cooldown-tag.active {
  background: rgba(255, 209, 102, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(255, 209, 102, 0.4);
}

.unit-hp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unit-status-card.enemy .unit-hp-bar-wrap {
  flex-direction: row-reverse;
}

.unit-hp-track {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.unit-hp-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.unit-hp-fill.player {
  background: linear-gradient(90deg, #06d6a0 0%, #4ecdc4 100%);
  box-shadow: 0 0 8px rgba(6, 214, 160, 0.4);
}

.unit-hp-fill.enemy {
  background: linear-gradient(90deg, #ef233c 0%, #ff4081 100%);
  box-shadow: 0 0 8px rgba(239, 35, 60, 0.4);
}

.unit-hp-val {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--text-muted);
  width: 54px;
}

.unit-points-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.unit-status-card.enemy .unit-points-row {
  flex-direction: row-reverse;
}

.point-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.point-label {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-muted);
}

.point-val {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: #fff;
}

.pips-wrap {
  display: flex;
  gap: 2px;
}

.pip {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.pip.ap.active {
  background: #ffd166;
  box-shadow: 0 0 4px rgba(255, 209, 102, 0.8);
}

.pip.ap.spent {
  background: rgba(255, 255, 255, 0.12);
}

.pip.mp.active {
  background: #38bdf8;
  box-shadow: 0 0 4px rgba(56, 189, 248, 0.8);
}

.pip.mp.spent {
  background: rgba(255, 255, 255, 0.12);
}

.battle-vs-badge {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 0.85rem;
  color: var(--accent-gold);
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 209, 102, 0.35);
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.2);
}

/* Battle Viewport & Canvas */
.battle-viewport {
  position: relative;
  width: 816px;
  height: 624px;
  max-width: 100%;
  max-height: calc(100vh - 220px);
  aspect-ratio: 816 / 624;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(78, 205, 196, 0.1);
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#battle-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

.battle-canvas-hints {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 6px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  pointer-events: none;
}

/* Inspector Tooltip Card (Hovering on Unit) */
.battle-inspector-tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  width: 290px;
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(255, 209, 102, 0.15);
  animation: fadeInTooltip 0.15s ease-out;
}

@keyframes fadeInTooltip {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.inspector-card {
  background: rgba(16, 18, 28, 0.95);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  color: var(--text-main);
}

.inspector-card.enemy {
  border-color: rgba(239, 35, 60, 0.4);
}

.inspector-card.player {
  border-color: rgba(78, 205, 196, 0.4);
}

.inspector-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.inspector-avatar {
  font-size: 1.6rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
}

.inspector-title-wrap {
  flex: 1;
}

.inspector-name {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.inspector-status-row {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.stat-badge {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 1px 5px;
  border-radius: 3px;
}

.stat-badge.buff { background: rgba(255, 209, 102, 0.2); color: var(--accent-gold); }
.stat-badge.debuff { background: rgba(239, 35, 60, 0.2); color: #ff6b81; }
.stat-badge.neutral { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }

.inspector-bars {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.inspector-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-muted);
}

.inspector-hp-track {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  overflow: hidden;
}

.inspector-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef233c 0%, #06d6a0 100%);
}

.inspector-points-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.inspector-points-row strong {
  color: #fff;
}

.inspector-spells-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.inspector-section-label {
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.inspector-spells-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.inspector-spell-item {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.spell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spell-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.78rem;
  color: #fff;
}

.inspector-spell-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  flex-shrink: 0;
}

.inspector-spell-icon-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}

.spell-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-pixel);
  font-size: 0.52rem;
}

.spell-cost {
  background: rgba(255, 209, 102, 0.2);
  color: var(--accent-gold);
  padding: 1px 4px;
  border-radius: 3px;
}

.spell-range {
  color: var(--text-muted);
}

.spell-cd.cooldown {
  background: rgba(239, 35, 60, 0.2);
  color: #ff6b81;
  padding: 1px 4px;
  border-radius: 3px;
}

.spell-cd.ready {
  background: rgba(6, 214, 160, 0.2);
  color: var(--accent-emerald);
  padding: 1px 4px;
  border-radius: 3px;
}

.spell-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.25;
  margin-top: 3px;
}

/* ========================================================
   PLAYER ABILITY ACTION DOCK (DOFUS / FIRE EMBLEM HYBRID)
======================================================== */
.battle-ability-dock {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 816px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(16, 18, 30, 0.95) 0%, rgba(10, 12, 20, 0.98) 100%);
  border-radius: 12px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 20px rgba(78, 205, 196, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  user-select: none;
  box-sizing: border-box;
}

.btn-battle-ability {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 8px;
  background: linear-gradient(180deg, rgba(28, 32, 50, 0.88) 0%, rgba(18, 20, 34, 0.95) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-body);
  flex: 1;
  min-width: 0;
  max-width: 130px;
  height: 68px;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-battle-ability:hover:not(.disabled) {
  background: linear-gradient(180deg, rgba(38, 44, 70, 0.95) 0%, rgba(24, 28, 46, 0.98) 100%);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 14px rgba(78, 205, 196, 0.35);
}

.btn-battle-ability.active {
  background: linear-gradient(180deg, rgba(30, 58, 80, 0.95) 0%, rgba(18, 36, 52, 0.98) 100%);
  border-color: var(--accent-gold);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.5), inset 0 0 10px rgba(255, 209, 102, 0.2);
  transform: translateY(-2px);
}

.btn-battle-ability.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.65);
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(18, 20, 30, 0.6);
}

/* Top Header Row of Action Button */
.ability-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-width: 0;
  line-height: 1;
}

.ability-key {
  font-family: var(--font-pixel), monospace;
  font-size: 0.55rem;
  background: rgba(0, 0, 0, 0.6);
  color: var(--accent-gold);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 209, 102, 0.35);
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.ability-ap-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 209, 102, 0.14);
  border: 1px solid rgba(255, 209, 102, 0.4);
  color: #ffd166;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  line-height: 1;
  flex-shrink: 0;
}

.ability-ap-pill .ap-icon {
  font-size: 0.6rem;
  line-height: 1;
}

.ability-ap-pill .ap-val {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

/* Body / Icon + Info Row */
.ability-body-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  flex: 1;
  margin-top: 3px;
}

.ability-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.battle-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease;
  flex-shrink: 0;
}

.btn-battle-ability:hover:not(.disabled) .battle-icon-img {
  transform: scale(1.1);
  filter: drop-shadow(0 0 6px rgba(78, 205, 196, 0.8));
}

.btn-battle-ability.active .battle-icon-img {
  transform: scale(1.12);
  filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.9));
}

.ability-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.ability-name {
  font-family: var(--font-title), 'Cinzel', serif;
  font-size: 0.74rem;
  font-weight: 700;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  letter-spacing: 0.2px;
}

.ability-meta {
  font-family: 'Nunito', var(--font-body), sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  margin-top: 1px;
}

.btn-battle-ability.active .ability-name {
  color: #fff9eb;
  text-shadow: 0 0 6px rgba(255, 209, 102, 0.6);
}

.btn-battle-ability.active .ability-meta {
  color: #ffd166;
}

/* End Turn Button */
.btn-battle-end-turn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #ef233c 0%, #a21caf 100%);
  border: 1.5px solid rgba(255, 110, 140, 0.55);
  border-radius: 9px;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-title);
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(239, 35, 60, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  flex: 1.15;
  min-width: 0;
  max-width: 145px;
  height: 68px;
  box-sizing: border-box;
}

.btn-battle-end-turn:hover:not(.disabled) {
  background: linear-gradient(135deg, #ff334b 0%, #c026d3 100%);
  border-color: #ff85a1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 35, 60, 0.65), 0 0 16px rgba(255, 110, 140, 0.45);
}

.btn-battle-end-turn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.7);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.btn-battle-end-turn .end-icon {
  font-size: 1.45rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  flex-shrink: 0;
  line-height: 1;
}

.btn-battle-end-turn .end-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.btn-battle-end-turn .end-title {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
  line-height: 1.1;
}

.btn-battle-end-turn .end-hotkey {
  font-family: var(--font-pixel), monospace;
  font-size: 0.52rem;
  color: #fef08a;
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(254, 240, 138, 0.35);
  line-height: 1;
}

/* Battle Sidebar */
.battle-sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.sidebar-panel {
  background: rgba(20, 22, 34, 0.85);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.battle-log-panel {
  flex: 1;
  min-height: 220px;
}

.mechanics-panel {
  flex-shrink: 0;
  max-height: 200px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(14, 16, 26, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-title);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
}

.log-feed {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.35;
}

.log-row {
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 2px solid transparent;
}

.log-row .log-time {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.log-row.phase { border-left-color: var(--accent-gold); color: var(--accent-gold); font-weight: 700; }
.log-row.player_action { border-left-color: var(--primary); color: #5eead4; }
.log-row.enemy_action { border-left-color: var(--accent-crimson); color: #ff85a1; }
.log-row.move { border-left-color: #38bdf8; color: #bae6fd; }
.log-row.victory { border-left-color: var(--accent-emerald); color: #6ee7b7; font-weight: 700; }
.log-row.defeat { border-left-color: var(--accent-crimson); color: #fda4af; font-weight: 700; }
.log-row.system { border-left-color: rgba(255, 255, 255, 0.2); color: var(--text-muted); }

.mechanics-list {
  padding: 10px 14px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.mechanics-list strong {
  color: #fff;
}

/* Battle Modal (Victory / Defeat) */
.battle-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.battle-modal-overlay.active {
  display: flex;
  animation: fadeInModal 0.25s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.battle-modal-card {
  background: rgba(18, 20, 32, 0.95);
  border-radius: 16px;
  padding: 36px 40px;
  text-align: center;
  max-width: 480px;
  border: 1px solid rgba(255, 209, 102, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 209, 102, 0.2);
}

/* ========================================================
   JRPG VICTORY MODAL & RETRO THEME
   ======================================================== */
.battle-modal-card.jrpg-victory-frame {
  max-width: 540px;
  width: 94vw;
  background: linear-gradient(180deg, #0b1435 0%, #060c24 100%);
  border: 2px solid #eab308;
  box-shadow: 
    0 0 0 1px #78350f, 
    0 0 0 3px #050a1f, 
    0 0 0 5px #ca8a04, 
    0 25px 70px rgba(0, 0, 0, 0.95), 
    inset 0 0 25px rgba(0, 0, 0, 0.8), 
    0 0 30px rgba(234, 179, 8, 0.25);
  padding: 22px 24px 20px 24px;
  border-radius: 8px;
  position: relative;
  overflow: visible;
}

/* Ornate Corner Accents */
.battle-modal-card.jrpg-victory-frame::before,
.battle-modal-card.jrpg-victory-frame::after {
  content: "◆";
  position: absolute;
  font-size: 10px;
  color: #fde047;
  text-shadow: 0 0 6px #eab308;
  pointer-events: none;
}
.battle-modal-card.jrpg-victory-frame::before {
  top: 4px;
  left: 6px;
}
.battle-modal-card.jrpg-victory-frame::after {
  top: 4px;
  right: 6px;
}

/* Top Crest (Sword & Laurel Wreath) */
.jrpg-victory-crest {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: -8px auto 2px auto;
  filter: drop-shadow(0 2px 10px rgba(234, 179, 8, 0.65));
}
.jrpg-victory-crest .crest-svg {
  width: 52px;
  height: 52px;
}

.jrpg-title-wrap {
  text-align: center;
  margin-bottom: 12px;
}

.jrpg-victory-title {
  font-family: 'Cinzel', var(--font-title), serif;
  font-size: 2.1rem;
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 0 16px rgba(253, 224, 71, 0.75), 0 2px 4px rgba(0, 0, 0, 0.9);
  letter-spacing: 2.5px;
  margin-bottom: 6px;
}

.jrpg-defeat-title {
  font-family: 'Cinzel', var(--font-title), serif;
  font-size: 2.1rem;
  font-weight: 900;
  color: #ef4444;
  text-shadow: 0 0 16px rgba(239, 68, 68, 0.75), 0 2px 4px rgba(0, 0, 0, 0.9);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.jrpg-subtitle-pill {
  background: #08102d;
  border: 1px solid rgba(234, 179, 8, 0.6);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.84rem;
  color: #e2e8f0;
  text-align: center;
  margin: 0 auto;
  max-width: 96%;
  font-family: var(--font-body);
}

/* Generic JRPG Panel Box */
.jrpg-panel-box {
  background: #08102b;
  border: 1px solid #ca8a04;
  box-shadow: 0 0 0 1px #040817, inset 0 0 10px rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

/* 1. Hero & EXP Box */
.jrpg-hero-exp-box {
  margin-top: 10px;
}

.jrpg-hero-exp-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.jrpg-hero-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jrpg-hero-sprite-frame {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.jrpg-hero-sprite {
  width: 48px;
  height: 48px;
  background-image: url('character/main1.png');
  background-position: -48px 0px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  transform: scale(0.95);
}

.jrpg-hero-tag {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.jrpg-hero-label {
  font-family: var(--font-pixel), sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  color: #7dd3fc;
  letter-spacing: 0.5px;
}

.jrpg-hero-lvl {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 0 10px rgba(253, 224, 71, 0.6);
}

.jrpg-hero-right {
  display: flex;
  gap: 24px;
  text-align: right;
}

.jrpg-exp-stat-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.jrpg-stat-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.jrpg-stat-val.cyan {
  font-family: var(--font-pixel), monospace;
  font-size: 0.88rem;
  font-weight: 800;
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.jrpg-stat-val.white {
  font-family: var(--font-pixel), monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.jrpg-exp-bar-wrap {
  width: 100%;
}

.jrpg-exp-bar-track {
  width: 100%;
  height: 10px;
  background: #040817;
  border: 1px solid rgba(234, 179, 8, 0.7);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.9);
}

.jrpg-exp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.85);
  transition: width 0.75s cubic-bezier(0.25, 1, 0.5, 1);
}

.jrpg-exp-bar-fill.flash {
  animation: expFlash 0.5s ease-out;
}

@keyframes expFlash {
  0% { filter: brightness(1); }
  50% { filter: brightness(2.5) drop-shadow(0 0 12px #fff); }
  100% { filter: brightness(1); }
}

/* 2. Level Up Panel & Stat Gains Grid */
.jrpg-levelup-box {
  animation: fadeInModal 0.35s ease-out;
}

.jrpg-levelup-header {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 900;
  color: #fde047;
  text-align: center;
  text-shadow: 0 0 12px rgba(253, 224, 71, 0.8);
  margin-bottom: 8px;
  letter-spacing: 1px;
  animation: levelUpPulse 1.8s ease-in-out infinite;
}

@keyframes levelUpPulse {
  0%, 100% { transform: scale(1); text-shadow: 0 0 10px rgba(253, 224, 71, 0.5); }
  50% { transform: scale(1.02); text-shadow: 0 0 18px rgba(253, 224, 71, 0.95); }
}

.jrpg-stat-grid-2x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.jrpg-stat-card {
  background: #091230;
  border: 1px solid rgba(234, 179, 8, 0.45);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.jrpg-stat-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.jrpg-stat-nums {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-pixel), monospace;
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffffff;
  margin: 1px 0;
}

.jrpg-stat-nums .stat-arrow {
  color: #fde047;
  font-size: 0.72rem;
}

.jrpg-stat-gain {
  font-family: var(--font-pixel), monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: #22c55e;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

/* 3. Gold Pill */
.jrpg-gold-row {
  display: flex;
  justify-content: center;
  margin: 4px 0 10px 0;
}

.jrpg-gold-pill {
  background: #08112e;
  border: 1px solid #eab308;
  box-shadow: 0 0 0 1px #040817, 0 0 12px rgba(234, 179, 8, 0.25);
  border-radius: 20px;
  padding: 4px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.jrpg-gold-coin-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.jrpg-gold-text {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 900;
  color: #fde047;
  letter-spacing: 0.5px;
}

/* 4. Spoils of War (Loot Box) */
.jrpg-loot-header {
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 800;
  color: #7dd3fc;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.jrpg-loot-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jrpg-loot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #070e24;
  border: 1px solid rgba(234, 179, 8, 0.4);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  padding: 8px 12px;
  animation: slideInDropCard 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes slideInDropCard {
  0% {
    transform: translateX(40px) scale(0.96);
    opacity: 0;
  }
  70% {
    transform: translateX(-3px) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.jrpg-loot-icon-box {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: #0c1538;
  border: 1px solid rgba(192, 132, 252, 0.6);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(168, 85, 247, 0.4);
}

.jrpg-loot-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(236, 72, 153, 0.7));
}

.jrpg-loot-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.jrpg-loot-top-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.jrpg-loot-name {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 900;
  color: #e879f9;
  text-shadow: 0 0 8px rgba(232, 121, 249, 0.5);
}

.jrpg-loot-qty {
  font-family: var(--font-pixel), monospace;
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffffff;
}

.jrpg-loot-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #d8b4fe;
  background: rgba(147, 51, 234, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.5);
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.jrpg-loot-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.35;
  margin: 0;
}

/* 5. JRPG Action Buttons */
.jrpg-actions-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.jrpg-btn {
  flex: 1;
  padding: 8px 6px;
  background: #091230;
  border: 1px solid #eab308;
  box-shadow: 0 0 0 1px #040817, inset 0 0 6px rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  color: #ffffff;
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease-out;
  text-decoration: none;
}

.jrpg-btn:hover {
  background: #19275e;
  border-color: #fde047;
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.45);
  transform: translateY(-1px);
}

.jrpg-btn.primary {
  background: linear-gradient(180deg, #1e3a8a 0%, #0f172a 100%);
  border-color: #fde047;
  color: #fde047;
}

.jrpg-btn .btn-icon {
  font-size: 0.95rem;
}

.jrpg-actions-row.single {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.jrpg-btn.proceed-btn {
  max-width: 240px;
  width: 100%;
  padding: 10px 24px;
  font-size: 1.05rem;
  letter-spacing: 1px;
}

.battle-modal-title.defeat {
  color: var(--accent-crimson);
  text-shadow: 0 0 20px rgba(239, 35, 60, 0.6);
}

.battle-modal-desc {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 24px;
}

.battle-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ========================================================
   OPTIONS / SETTINGS MODAL STYLES
======================================================== */
.options-card {
  width: 92vw;
  max-width: 580px;
  background: rgba(14, 16, 26, 0.97);
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.92), 0 0 30px rgba(255, 209, 102, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.options-header {
  padding: 16px 22px;
  background: rgba(22, 26, 42, 0.95);
  border-bottom: 1px solid rgba(255, 209, 102, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.options-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.options-title {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 1.35rem;
  color: var(--accent-gold);
}

.options-subtitle {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.options-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.option-name {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 1.05rem;
  color: #ffffff;
}

.option-val-badge {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.9rem;
  color: var(--accent-gold);
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.3);
  padding: 2px 10px;
  border-radius: 4px;
}

.option-slider {
  width: 100%;
  accent-color: var(--accent-gold);
  cursor: pointer;
  height: 6px;
  border-radius: 3px;
  background: #25293d;
}

.option-help-text {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dialogue-preview-box {
  margin-top: 4px;
  padding: 12px 16px;
  border: 2px solid rgba(255, 209, 102, 0.65);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 23, 36, var(--dialogue-bg-alpha, 0.7)) 0%, rgba(9, 11, 18, var(--dialogue-bg-alpha, 0.7)) 100%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.2s ease;
}

.preview-speaker {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.9rem;
  color: var(--accent-gold);
  font-weight: bold;
}

.preview-text {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.95rem;
  color: #ffffff;
}

.options-footer {
  padding: 14px 22px;
  background: rgba(18, 22, 36, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
}

/* ========================================================
   SAVE & LOAD SYSTEM (20 SLOTS) & CONTINUE BUTTON
======================================================== */
.btn-menu.continue-option {
  border-color: rgba(52, 211, 153, 0.45);
  background: linear-gradient(135deg, rgba(16, 45, 35, 0.85) 0%, rgba(10, 26, 20, 0.95) 100%);
}

.btn-menu.continue-option .icon {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.btn-menu.continue-option:hover {
  border-color: #34d399;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 20px rgba(52, 211, 153, 0.3);
}

.btn-nav.save-btn {
  background: linear-gradient(180deg, #1e3a8a 0%, #172554 100%);
  border-color: #3b82f6;
  color: #bfdbfe;
  font-weight: bold;
}

.btn-nav.save-btn:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.5);
}

.save-game-card {
  width: 95vw;
  max-width: 920px;
  height: 86vh;
  max-height: 760px;
  background: rgba(14, 16, 26, 0.98);
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 14px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 35px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.save-modal-header {
  padding: 16px 24px;
  background: rgba(22, 26, 42, 0.95);
  border-bottom: 1px solid rgba(255, 209, 102, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.save-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-modal-title {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 1.35rem;
  color: var(--accent-gold);
  margin: 0;
}

.save-modal-subtitle {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.save-modal-body {
  flex: 1;
  padding: 18px 22px;
  overflow-y: auto;
  background: #090b14;
}

.save-modal-body::-webkit-scrollbar {
  width: 8px;
}

.save-modal-body::-webkit-scrollbar-track {
  background: #101320;
}

.save-modal-body::-webkit-scrollbar-thumb {
  background: #252b45;
  border-radius: 4px;
}

.save-modal-body::-webkit-scrollbar-thumb:hover {
  background: #3a446c;
}

.save-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  gap: 14px;
}

@media (max-width: 860px) {
  .save-slots-grid {
    grid-template-columns: 1fr;
  }
}

.save-slot-card {
  background: #131728;
  border: 1px solid #28304c;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.save-slot-card:hover {
  border-color: rgba(255, 209, 102, 0.5);
  background: #181d33;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.save-slot-card.empty {
  border-style: dashed;
  border-color: #23293f;
  background: rgba(14, 17, 28, 0.6);
  opacity: 0.85;
}

.save-slot-card.empty:hover {
  opacity: 1;
  border-color: #3b466b;
  background: rgba(18, 22, 38, 0.85);
}

.save-slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.save-slot-badge {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--accent-gold);
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.save-slot-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.save-slot-location {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 1.05rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.save-slot-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.save-stat-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #cbd5e1;
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
}

.save-stat-pill.level { color: #fde047; font-weight: bold; }
.save-stat-pill.gold { color: #fbbf24; }
.save-stat-pill.hp { color: #f87171; }
.save-stat-pill.mp { color: #60a5fa; }
.save-stat-pill.steps { color: #94a3b8; }

.save-slot-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.slot-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.85rem;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.slot-btn-save {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  border-color: #3b82f6;
  color: #ffffff;
}

.slot-btn-save:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.slot-btn-load {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  border-color: #10b981;
  color: #ffffff;
}

.slot-btn-load:hover {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.slot-btn-delete {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.slot-btn-delete:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #ffffff;
}

.save-slot-empty-body {
  padding: 10px 0;
  text-align: center;
  color: #64748b;
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.9rem;
}

.save-modal-footer {
  padding: 12px 24px;
  background: rgba(18, 22, 36, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.save-storage-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.save-storage-badge code {
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 4px;
  color: #cbd5e1;
  font-family: monospace;
  font-size: 0.85rem;
}

/* ========================================================
   GLOBAL TELEPORT FADE-IN / FADE-OUT OVERLAY
======================================================== */
.teleport-fade-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  z-index: 99999;
}

.teleport-fade-overlay.fade-black {
  opacity: 1;
  pointer-events: auto;
}

/* ========================================================
   RIFT DOORS SELECTION SCREEN (THE ABYSSAL THRESHOLD)
======================================================== */
#rift-doors-screen {
  flex-direction: column;
  background-color: #06030c;
}

#rift-doors-screen.active {
  display: flex !important;
}

.rift-header {
  border-bottom: 1px solid rgba(199, 125, 255, 0.25) !important;
  background: rgba(10, 6, 18, 0.94) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 25px rgba(123, 44, 191, 0.15);
}

.rift-badge {
  border-color: rgba(199, 125, 255, 0.4) !important;
  background: rgba(60, 9, 108, 0.35) !important;
  color: #e0aaff !important;
  box-shadow: 0 0 15px rgba(157, 78, 221, 0.3);
}

.rift-doors-viewport {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 20px 20px;
  overflow: hidden;
  user-select: none;
}

.rift-bg-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('bg/rift.png') center/cover no-repeat;
  opacity: 0.38;
  filter: blur(1.5px) saturate(1.3);
  z-index: 1;
}

.rift-ambient-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 45%, rgba(60, 9, 108, 0.25) 0%, rgba(16, 0, 43, 0.8) 65%, #05020a 95%);
  z-index: 2;
  pointer-events: none;
}

.rift-particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* Title & Banner */
.rift-title-banner {
  position: relative;
  z-index: 10;
  text-align: center;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rift-banner-pill {
  font-family: var(--font-pixel), 'Press Start 2P', monospace;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: #e0aaff;
  background: rgba(60, 9, 108, 0.5);
  border: 1px solid rgba(199, 125, 255, 0.45);
  padding: 4px 14px;
  border-radius: 20px;
  box-shadow: 0 0 15px rgba(157, 78, 221, 0.35);
  text-transform: uppercase;
}

.rift-main-title {
  font-family: var(--font-title), 'Cinzel', serif;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 3px;
  margin: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f3c4fb 35%, #c77dff 70%, #9d4edd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 25px rgba(199, 125, 255, 0.6));
  text-transform: uppercase;
}

.rift-desc {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.95rem;
  color: #d8b4e2;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* The 5 Doors Container */
.rift-doors-container {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  width: 100%;
  max-width: 1380px;
  flex: 1;
  margin: 8px 0;
}

/* Individual Door Card */
.rift-door-card {
  position: relative;
  width: 215px;
  max-width: 20vw;
  height: 410px;
  max-height: calc(100vh - 210px);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(80px) scale(0.88);
  animation: riftDoorSlideIn 1.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.35s ease;
  user-select: none;
}

.rift-door-card.unlocked {
  cursor: pointer;
}

.rift-door-card.locked {
  cursor: not-allowed;
  filter: grayscale(0.85) brightness(0.42) contrast(0.9);
  opacity: 0.72;
}

.rift-door-card.locked:hover {
  filter: grayscale(0.7) brightness(0.55) contrast(0.95);
}

.rift-door-card.shake-locked {
  animation: lockedDoorShake 0.45s ease;
}

.rift-door-floating-body {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: riftDoorFloat 4.2s ease-in-out infinite alternate;
  animation-delay: calc(var(--door-idx, 0) * 0.45s);
}

/* Floating Animation */
@keyframes riftDoorFloat {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-11px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Slide-in Entrance */
@keyframes riftDoorSlideIn {
  0% {
    opacity: 0;
    transform: translateY(80px) scale(0.88);
  }
  100% {
    opacity: 1;
    transform: translateY(0px) scale(1);
  }
}

/* Shake Animation on locked click */
@keyframes lockedDoorShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-9px); }
  30% { transform: translateX(9px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}

/* Ambient Additive Glow */
.rift-door-ambient-glow {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(199, 125, 255, 0.45) 0%, rgba(157, 78, 221, 0.25) 45%, transparent 70%);
  filter: blur(16px);
  mix-blend-mode: plus-lighter;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 0;
}

.rift-door-card.unlocked:hover .rift-door-ambient-glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.25);
  background: radial-gradient(circle, rgba(247, 37, 133, 0.55) 0%, rgba(199, 125, 255, 0.45) 45%, transparent 75%);
}

.rift-door-card.unlocked:hover {
  transform: scale(1.045) translateY(-4px);
  filter: drop-shadow(0 0 25px rgba(199, 125, 255, 0.75)) drop-shadow(0 0 45px rgba(157, 78, 221, 0.45));
}

.rift-door-card.unlocked:hover .rift-door-svg {
  filter: drop-shadow(0 0 18px #e0aaff) drop-shadow(0 0 35px #9d4edd);
}

/* Portal Stage */
.rift-door-portal-stage {
  position: relative;
  width: 100%;
  height: 275px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

.rift-door-arch-frame {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.rift-door-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 10px rgba(157, 78, 221, 0.5));
  transition: filter 0.35s ease;
}

/* Swirling Vortex Field */
.rift-door-vortex-wrap {
  position: absolute;
  top: 36px;
  left: 36px;
  right: 36px;
  bottom: 12px;
  border-radius: 64px 64px 4px 4px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.rift-door-vortex {
  position: absolute;
  width: 180%;
  height: 180%;
  background: conic-gradient(
    from 0deg,
    rgba(60, 9, 108, 0.9),
    rgba(123, 44, 191, 0.8),
    rgba(224, 170, 255, 0.95),
    rgba(247, 37, 133, 0.8),
    rgba(76, 201, 240, 0.7),
    rgba(60, 9, 108, 0.9)
  );
  opacity: 0.65;
  mix-blend-mode: screen;
  filter: blur(5px);
}

.rift-door-vortex.active {
  animation: riftVortexSpin 8s linear infinite;
}

.rift-door-vortex.dormant {
  opacity: 0.2;
  filter: grayscale(1) blur(6px);
}

@keyframes riftVortexSpin {
  0% { transform: rotate(0deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1.05); }
}

.rift-door-stars {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(1.5px 1.5px at 20px 30px, #ffffff, transparent),
    radial-gradient(1px 1px at 70px 60px, #e0aaff, transparent),
    radial-gradient(1.5px 1.5px at 120px 90px, #4cc9f0, transparent),
    radial-gradient(1px 1px at 50px 140px, #ffffff, transparent),
    radial-gradient(1.5px 1.5px at 95px 180px, #f72585, transparent);
  opacity: 0.85;
  animation: starsShimmer 3s ease-in-out infinite alternate;
}

@keyframes starsShimmer {
  0% { opacity: 0.4; transform: scale(0.98); }
  100% { opacity: 0.95; transform: scale(1.02); }
}

.rift-door-energy-beam {
  position: absolute;
  bottom: 0;
  width: 70%;
  height: 60%;
  background: linear-gradient(to top, rgba(224, 170, 255, 0.6) 0%, rgba(199, 125, 255, 0.3) 50%, transparent 100%);
  filter: blur(6px);
  mix-blend-mode: plus-lighter;
  animation: energyPulse 2.5s ease-in-out infinite alternate;
}

@keyframes energyPulse {
  0% { opacity: 0.4; height: 50%; }
  100% { opacity: 0.9; height: 75%; }
}

/* Level Requirement Badge */
.rift-door-req-badge {
  position: absolute;
  top: -12px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 14px;
  font-family: var(--font-pixel), 'Press Start 2P', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.rift-door-req-badge.unlocked {
  background: rgba(123, 44, 191, 0.9);
  border: 1px solid #e0aaff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(199, 125, 255, 0.7);
}

.rift-door-req-badge.unlocked .req-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #06d6a0;
  box-shadow: 0 0 8px #06d6a0;
}

.rift-door-req-badge.locked {
  background: rgba(26, 29, 36, 0.92);
  border: 1px solid #495057;
  color: #adb5bd;
}

.rift-door-req-badge.locked .req-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6c757d;
}

/* Bounty Badge on Door 1 */
.rift-door-bounty-badge {
  position: absolute;
  top: 24px;
  z-index: 15;
  background: linear-gradient(135deg, rgba(208, 0, 0, 0.95), rgba(144, 0, 32, 0.95));
  border: 1px solid #ffd166;
  border-radius: 8px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 18px rgba(230, 57, 70, 0.85), inset 0 0 8px rgba(255, 209, 102, 0.4);
  animation: bountyGlow 2s ease-in-out infinite alternate;
}

@keyframes bountyGlow {
  0% { box-shadow: 0 0 12px rgba(230, 57, 70, 0.6); }
  100% { box-shadow: 0 0 24px rgba(255, 112, 166, 0.95), inset 0 0 12px rgba(255, 209, 102, 0.6); }
}

.bounty-badge-content {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bounty-badge-title {
  font-family: var(--font-pixel), 'Press Start 2P', monospace;
  font-size: 0.58rem;
  color: #ffd166;
  font-weight: 700;
  letter-spacing: 1px;
}

.bounty-badge-target {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.78rem;
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Locked Overlay */
.rift-door-locked-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
  pointer-events: none;
}

.locked-chain-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.9));
}

.locked-rune-text {
  font-family: var(--font-pixel), 'Press Start 2P', monospace;
  font-size: 0.62rem;
  color: #e63946;
  letter-spacing: 2px;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(230, 57, 70, 0.5);
}

.locked-req-note {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.75rem;
  color: #adb5bd;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Door Info Card */
.rift-door-info-card {
  position: relative;
  z-index: 3;
  width: 100%;
  background: rgba(14, 10, 24, 0.9);
  border: 1px solid rgba(199, 125, 255, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
}

.rift-door-card.unlocked .rift-door-info-card {
  border-color: rgba(199, 125, 255, 0.45);
  background: rgba(22, 14, 38, 0.92);
}

.door-gate-num {
  font-family: var(--font-pixel), 'Press Start 2P', monospace;
  font-size: 0.6rem;
  color: #e0aaff;
  letter-spacing: 1.5px;
}

.door-gate-name {
  font-family: var(--font-title), 'Cinzel', serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.door-gate-sub {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.72rem;
  color: #c77dff;
  text-align: center;
}

.door-breach-btn {
  width: 100%;
  margin-top: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-title), 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.door-breach-btn.primary {
  background: linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(157, 78, 221, 0.5);
  border: 1px solid #e0aaff;
}

.door-breach-btn.primary:hover {
  background: linear-gradient(135deg, #c77dff 0%, #9d4edd 100%);
  box-shadow: 0 0 25px rgba(199, 125, 255, 0.8);
  transform: translateY(-1px);
}

.door-breach-btn.disabled {
  background: rgba(33, 37, 41, 0.8);
  color: #6c757d;
  border: 1px solid #495057;
  cursor: not-allowed;
}

/* Bottom Hint / Info Bar */
.rift-bottom-bar {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 960px;
  display: flex;
  justify-content: center;
}

.rift-info-box {
  background: rgba(14, 9, 26, 0.92);
  border: 1px solid rgba(199, 125, 255, 0.35);
  border-radius: 24px;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 20px rgba(123, 44, 191, 0.2);
  backdrop-filter: blur(10px);
}

.rift-info-box .info-icon {
  font-size: 1.2rem;
  filter: drop-shadow(0 0 8px #c77dff);
}

.rift-info-box .info-text {
  font-family: var(--font-fantasy), 'MedievalSharp', cursive, serif;
  font-size: 0.92rem;
  color: #f3c4fb;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* ========================================================
   GLOBAL DIMENSIONAL RIFT TRANSITION OVERLAY (PURPLE VIGNETTE & WARP PARTICLES)
======================================================== */
.rift-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0;
  z-index: 99999;
  overflow: hidden;
  display: none;
  background: transparent;
  transition: opacity 0.4s ease;
}

.rift-transition-overlay.active {
  display: block !important;
  pointer-events: auto;
  opacity: 1;
}

/* Suction & Warp Particles + Continuous 60fps Radial Vignette Canvas */
.rift-transition-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Dedicated 3-Second Blackout Overlay (Legacy / Door Breach) */
.rift-blackout-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000000;
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
}

.rift-blackout-overlay.active {
  pointer-events: auto;
}

/* ========================================================
   ALYS & ADVANCED TACTICAL BATTLE UI STYLES
======================================================== */
.battle-opponent-picker select {
  font-family: var(--font-title, sans-serif);
  transition: all 0.2s ease;
}
.battle-opponent-picker select:hover {
  border-color: #ffd166 !important;
  box-shadow: 0 0 10px rgba(255, 64, 129, 0.4);
}

/* Seduced Heart Meter (Player POV) */
.unit-seduced-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(255, 64, 129, 0.12);
  border: 1px solid rgba(255, 64, 129, 0.35);
  border-radius: 6px;
  padding: 3px 8px;
  margin-top: 4px;
}
.seduced-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}
.seduced-icon {
  font-size: 0.85rem;
  animation: heartThrob 1.2s infinite ease-in-out;
}
@keyframes heartThrob {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); filter: drop-shadow(0 0 4px #ff4081); }
}
.seduced-title {
  color: #ff80ab;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.seduced-val {
  margin-left: auto;
  color: #fff;
  font-family: var(--font-pixel, monospace);
}
.unit-seduced-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 64, 129, 0.4);
}
.unit-seduced-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4081, #ff80ab, #f50057);
  box-shadow: 0 0 8px rgba(255, 64, 129, 0.8);
  transition: width 0.35s ease-out;
}
.unit-seduced-fill.high {
  background: linear-gradient(90deg, #f50057, #ff1744, #d50000);
  animation: seduceGlow 0.8s infinite alternate;
}
@keyframes seduceGlow {
  from { box-shadow: 0 0 6px #ff4081; }
  to { box-shadow: 0 0 16px #ff1744; }
}

/* Grip Countdown Warning Banner */
.battle-grip-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(136, 14, 79, 0.95), rgba(74, 20, 140, 0.95));
  border: 2px solid #ff4081;
  border-radius: 20px;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title, sans-serif);
  font-size: 0.85rem;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 64, 129, 0.6), 0 0 10px rgba(255, 64, 129, 0.4);
  z-index: 50;
  animation: gripPulse 1.2s infinite ease-in-out;
}
@keyframes gripPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.03); box-shadow: 0 4px 25px rgba(255, 64, 129, 0.9); }
}

/* Battle Dialogue Cut-in Overlay (Succubus Grip) */
.battle-cutin-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 120;
  cursor: pointer;
  animation: cutinFade 0.25s ease-out;
}
@keyframes cutinFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.battle-cutin-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(26, 14, 38, var(--dialogue-bg-alpha, 0.7)) 0%, rgba(48, 18, 58, var(--dialogue-bg-alpha, 0.7)) 100%);
  border: 2px solid #ff4081;
  border-radius: 16px;
  padding: 20px 28px;
  max-width: 640px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 35px rgba(255, 64, 129, 0.5);
  backdrop-filter: blur(calc(12px * var(--dialogue-bg-alpha, 0.7)));
  -webkit-backdrop-filter: blur(calc(12px * var(--dialogue-bg-alpha, 0.7)));
  transition: background 0.25s ease;
}
.battle-cutin-portrait-wrap {
  width: 110px;
  height: 140px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #ff80ab;
  background: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(255, 64, 129, 0.4);
}
.battle-cutin-portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.battle-cutin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.battle-cutin-speaker {
  font-family: var(--font-title, sans-serif);
  font-size: 1.1rem;
  font-weight: bold;
  color: #ff80ab;
  text-shadow: 0 0 10px rgba(255, 128, 171, 0.6);
}
.battle-cutin-text {
  font-size: 1.05rem;
  line-height: 1.45;
  color: #fff;
  font-style: italic;
  min-height: 48px;
}
.battle-cutin-prompt {
  font-size: 0.75rem;
  color: #ffd166;
  text-align: right;
  margin-top: 4px;
  animation: promptBlink 1s infinite alternate;
}
@keyframes promptBlink {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* Scene Unlock Modal */
.battle-modal-title.scene {
  color: #ff4081;
  text-shadow: 0 0 20px rgba(255, 64, 129, 0.8);
}
.scene-portrait-wrap {
  width: 120px;
  height: 150px;
  margin: 0 auto 16px auto;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #ff4081;
  box-shadow: 0 0 20px rgba(255, 64, 129, 0.5);
}
.scene-portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* ========================================================
   IN-BATTLE FULLSCREEN CG SCENE OVERLAY (SUCCUBUS KISS / SCENE 2)
======================================================== */
.battle-cg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 130;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.battle-cg-bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  background: #000;
}

.battle-cg-bg-layer.active {
  opacity: 1;
  pointer-events: auto;
}

.battle-cg-bg-layer.fade-quick {
  transition: opacity 0.35s ease-out;
}

.battle-cg-bg-layer.fade-1s {
  transition: opacity 1.0s ease-in-out;
}

.battle-cg-bg-layer.fade-instant {
  transition: none !important;
  opacity: 0 !important;
}

.battle-cg-bg-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.battle-cg-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
  z-index: 2;
}

.battle-cg-blackout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.battle-cg-blackout.active {
  opacity: 1;
  pointer-events: auto;
}

.battle-cg-blackout.clear {
  opacity: 0;
  pointer-events: none;
}

.battle-cg-blackout.fade-quick {
  transition: opacity 0.35s ease-out;
}

.battle-cg-blackout.fade-1s {
  transition: opacity 1.0s ease-in-out;
}

.battle-cg-dialogue-wrap {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 860px;
  z-index: 20;
  pointer-events: none;
}

.battle-cg-dialogue-box {
  background: linear-gradient(135deg, rgba(20, 10, 32, var(--dialogue-bg-alpha, 0.7)) 0%, rgba(46, 16, 56, var(--dialogue-bg-alpha, 0.7)) 100%);
  border: 2px solid #ff4081;
  border-radius: 16px;
  padding: 18px 24px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.95), 0 0 30px rgba(255, 64, 129, 0.45);
  position: relative;
  backdrop-filter: blur(calc(12px * var(--dialogue-bg-alpha, 0.7)));
  -webkit-backdrop-filter: blur(calc(12px * var(--dialogue-bg-alpha, 0.7)));
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.25s ease, opacity 0.3s ease;
}

.battle-cg-dialogue-box.has-face {
  padding-left: 95px;
}

.battle-cg-speaker-face {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 68px;
  height: 68px;
}

.battle-cg-face-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid #ff4081;
  box-shadow: 0 0 16px rgba(255, 64, 129, 0.6);
  background: #14051a;
}

.battle-cg-face-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.battle-cg-speaker-badge {
  align-self: flex-start;
  background: linear-gradient(90deg, #ff4081, #9d4edd);
  border-radius: 8px;
  padding: 3px 12px;
  font-family: var(--font-title, sans-serif);
  font-weight: bold;
  font-size: 0.9rem;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  box-shadow: 0 2px 8px rgba(255, 64, 129, 0.4);
}

.battle-cg-speaker-badge.damian {
  background: linear-gradient(90deg, #3a86ff, #0077b6);
  box-shadow: 0 2px 8px rgba(58, 134, 255, 0.4);
}

.battle-cg-dialogue-body {
  font-size: 1.12rem;
  line-height: 1.45;
  color: #ffffff;
  min-height: 42px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.battle-cg-dialogue-body p {
  margin: 0;
  font-style: italic;
}

.battle-cg-advance-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}

.battle-cg-advance-prompt {
  font-size: 0.78rem;
  color: #ffd166;
  animation: promptBlink 1s infinite alternate;
  letter-spacing: 0.5px;
}

/* Pink Magical Flash on CG Image Entry & Crossfades */
.battle-cg-pink-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(255, 128, 200, 0.85) 0%, rgba(255, 64, 129, 0.6) 55%, rgba(160, 0, 110, 0.75) 100%);
  mix-blend-mode: screen;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.85s cubic-bezier(0.25, 1, 0.5, 1);
}

.battle-cg-pink-flash.flash {
  opacity: 1;
  transition: opacity 0.06s ease-out;
}

.battle-cg-pink-flash.aura-pulse {
  opacity: 0.65;
  animation: pinkAuraGlow 1.8s ease-in-out infinite alternate;
}

@keyframes pinkAuraGlow {
  0% { opacity: 0.3; filter: brightness(1.1); }
  50% { opacity: 0.7; filter: brightness(1.35) drop-shadow(0 0 30px #ff4081); }
  100% { opacity: 0.35; filter: brightness(1.15); }
}

/* ========================================================
   IN-BATTLE VISUAL NOVEL DIALOGUE MODE (CENTER PORTRAIT)
======================================================== */
.battle-vn-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
}

.battle-vn-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(20, 10, 28, 0.45) 0%, rgba(8, 4, 14, 0.82) 100%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.battle-vn-backdrop.active {
  opacity: 1;
}

.battle-vn-overlay .story-sprites-layer {
  z-index: 15;
}

.battle-vn-overlay .story-dialogue-wrap {
  z-index: 25;
  display: flex;
  justify-content: center;
}

/* Whiteout Screen for Climax Fade */
.battle-cg-whiteout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.8s ease-in-out;
}

.battle-cg-whiteout.active {
  opacity: 1;
  pointer-events: auto;
}

.battle-cg-whiteout.clear {
  opacity: 0;
  pointer-events: none;
}

/* Choice Prompt Overlay */
.battle-cg-choice-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  width: 90%;
  max-width: 520px;
  pointer-events: auto;
}

.battle-cg-choice-box {
  background: linear-gradient(135deg, rgba(20, 10, 32, var(--dialogue-bg-alpha, 0.7)) 0%, rgba(46, 16, 56, var(--dialogue-bg-alpha, 0.7)) 100%);
  border: 2px solid #ff4081;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 35px rgba(255, 64, 129, 0.5);
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: center;
  backdrop-filter: blur(calc(12px * var(--dialogue-bg-alpha, 0.7)));
  -webkit-backdrop-filter: blur(calc(12px * var(--dialogue-bg-alpha, 0.7)));
  animation: modalScaleIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  transition: background 0.25s ease;
}

.battle-cg-choice-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.battle-cg-choice-badge {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #ff758f;
  background: rgba(255, 64, 129, 0.15);
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 64, 129, 0.3);
}

.battle-cg-choice-title {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  text-shadow: 0 0 10px rgba(255, 64, 129, 0.6);
}

.battle-cg-choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.battle-cg-choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 14px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-align: left;
  font-family: inherit;
}

.battle-cg-choice-btn.accept {
  background: linear-gradient(135deg, rgba(255, 64, 129, 0.25), rgba(255, 117, 143, 0.15));
  border-color: #ff4081;
  color: #fff;
}

.battle-cg-choice-btn.accept:hover {
  background: linear-gradient(135deg, #ff4081, #ff758f);
  box-shadow: 0 0 25px rgba(255, 64, 129, 0.8);
  transform: translateY(-3px) scale(1.02);
}

.battle-cg-choice-btn.refuse {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(30, 58, 138, 0.25));
  border-color: #38bdf8;
  color: #fff;
}

.battle-cg-choice-btn.refuse:hover {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.8);
  transform: translateY(-3px) scale(1.02);
}

.choice-btn-icon {
  font-size: 1.6rem;
}

.choice-btn-text {
  display: flex;
  flex-direction: column;
}

.choice-btn-text strong {
  font-size: 1rem;
  color: #fff;
}

.choice-btn-text small {
  font-size: 0.8rem;
  color: #cbd5e1;
}

/* ========================================================
   CHEST LOOT QUICK PROMPT
======================================================== */
.chest-loot-prompt {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 10050;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(16, 20, 36, 0.96) 0%, rgba(28, 24, 44, 0.96) 100%);
  border: 2px solid var(--accent-gold);
  border-radius: 14px;
  padding: 12px 22px 12px 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(255, 209, 102, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: chestLootPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.chest-loot-prompt.fade-out {
  animation: chestLootFadeOut 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes chestLootPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(24px) scale(0.82);
  }
  70% {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes chestLootFadeOut {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-24px) scale(0.92);
  }
}

.chest-loot-icon-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.25) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(255, 209, 102, 0.7);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.4);
  flex-shrink: 0;
}

.chest-loot-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.7));
  animation: chestIconPulse 2s ease-in-out infinite;
}

@keyframes chestIconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.chest-loot-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chest-loot-tag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: var(--accent-gold);
  text-transform: uppercase;
  font-family: var(--font-body);
}

.chest-loot-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.4px;
  font-family: var(--font-body);
}

.chest-loot-badge {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.28), rgba(255, 107, 107, 0.25));
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 1.15rem;
  padding: 4px 14px;
  border-radius: 20px;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.5);
  font-family: var(--font-body);
  flex-shrink: 0;
  margin-left: 6px;
}

/* ========================================================
   12. MODERN CORRUPTION SPOTLIGHT WALKTHROUGH OVERLAY
======================================================== */
.spotlight-tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100060 !important;
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.spotlight-tutorial-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.spotlight-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 75% 20px, rgba(16, 10, 30, 0.88) 0%, rgba(4, 5, 12, 0.95) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1;
}

/* Dynamic Spotlight Beacon on Top HUD Meter */
.hud-spotlight-beacon {
  position: fixed;
  pointer-events: none;
  z-index: 100070;
  border-radius: 6px;
  box-sizing: border-box;
  display: none;
  align-items: center;
  justify-content: center;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}

.beacon-pill-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(35, 22, 58, 0.98) 0%, rgba(20, 12, 34, 1) 100%);
  border: 1.5px solid #c084fc;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #d8b4fe;
  box-shadow: 0 0 22px rgba(192, 132, 252, 0.75), inset 0 0 10px rgba(192, 132, 252, 0.35);
  white-space: nowrap;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

.beacon-pill-icon {
  font-size: 1rem;
  filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.9));
}

.beacon-pill-label {
  color: #e9d5ff;
  font-family: var(--font-body);
}

.beacon-pill-value {
  color: #f472b6;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(244, 114, 182, 0.8);
}

.beacon-pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px solid #c084fc;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(192, 132, 252, 0.8), inset 0 0 15px rgba(192, 132, 252, 0.4);
  animation: beaconPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.beacon-pulse-ring-outer {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 1.5px solid rgba(168, 85, 247, 0.5);
  border-radius: 14px;
  animation: beaconPulseOuter 2s cubic-bezier(0.4, 0, 0.6, 1) infinite 0.4s;
}

@keyframes beaconPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.9;
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.8), inset 0 0 15px rgba(192, 132, 252, 0.4);
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
    box-shadow: 0 0 35px rgba(192, 132, 252, 1), inset 0 0 22px rgba(192, 132, 252, 0.6);
  }
}

@keyframes beaconPulseOuter {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.8;
  }
}

.beacon-callout-tag {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: tagBounce 2s ease-in-out infinite;
}

.beacon-arrow {
  color: #c084fc;
  font-size: 0.75rem;
  line-height: 1;
  text-shadow: 0 0 8px rgba(192, 132, 252, 0.8);
  margin-bottom: -2px;
}

.beacon-text {
  background: linear-gradient(135deg, #3b1660 0%, #1e0f38 100%);
  border: 1px solid #c084fc;
  color: #f3e8ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 12px rgba(192, 132, 252, 0.4);
}

@keyframes tagBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(4px); }
}

/* Spotlighted Pill elevation during tutorial */
.hud-stat-pill.spotlight-active {
  z-index: 100075 !important;
  position: relative !important;
  border-color: #c084fc !important;
  box-shadow: 0 0 25px rgba(192, 132, 252, 0.9), 0 0 50px rgba(168, 85, 247, 0.5) !important;
}

/* Modern Glassmorphic Tour Card */
.spotlight-tour-card {
  position: relative;
  z-index: 10;
  width: 620px;
  max-width: 92vw;
  background: linear-gradient(180deg, rgba(24, 18, 40, 0.97) 0%, rgba(12, 10, 22, 0.98) 100%);
  border: 1.5px solid rgba(168, 85, 247, 0.45);
  border-radius: 18px;
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.95), 0 0 50px rgba(168, 85, 247, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: tourCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tourCardIn {
  0% { transform: scale(0.92) translateY(14px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.tour-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(38, 24, 64, 0.9) 0%, rgba(20, 14, 36, 0.9) 100%);
  border-bottom: 1px solid rgba(168, 85, 247, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tour-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tour-glyph-box {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #381a60 0%, #1c0f33 100%);
  border: 1px solid #a855f7;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.4);
}

.tour-glyph {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(192, 132, 252, 0.8));
}

.tour-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #c084fc;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.tour-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: #f3e8ff;
  margin: 0;
  letter-spacing: 0.4px;
  text-shadow: 0 0 12px rgba(192, 132, 252, 0.35);
}

.tour-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tour-step-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
}

.step-dot.active {
  width: 22px;
  background: #c084fc;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.7);
}

.tour-btn-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d1d5db;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.tour-btn-close:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fee2e2;
}

.tour-body {
  padding: 24px;
  min-height: 230px;
  display: flex;
  flex-direction: column;
}

.tour-slide {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: slideFadeIn 0.28s ease-out;
}

.tour-slide.active {
  display: flex;
}

@keyframes slideFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Slide 1 Components */
.tour-highlight-box {
  background: rgba(168, 85, 247, 0.07);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tour-meter-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meter-preview-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: #e9d5ff;
}

.meter-val-tag {
  margin-left: auto;
  background: linear-gradient(135deg, #3b1660 0%, #201036 100%);
  border: 1px solid #c084fc;
  padding: 3px 12px;
  border-radius: 20px;
  color: #f472b6;
  font-size: 1rem;
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.3);
}

.meter-bar-track {
  width: 100%;
  height: 12px;
  background: #0d0b17;
  border: 1px solid #3c2a5c;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.meter-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #9333ea 0%, #ec4899 100%);
  border-radius: 5px;
  position: relative;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.tour-highlight-hint {
  font-size: 0.82rem;
  color: #c084fc;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.hint-bullet {
  color: #f472b6;
  font-size: 0.9rem;
}

/* Feature Grid (Slides 2 & 3) */
.tour-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 580px) {
  .tour-feature-grid {
    grid-template-columns: 1fr;
  }
}

.tour-feature-card {
  background: rgba(22, 17, 36, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  gap: 12px;
  transition: all 0.2s ease;
}

.tour-feature-card:hover {
  background: rgba(28, 22, 48, 0.95);
  border-color: rgba(192, 132, 252, 0.5);
  transform: translateY(-2px);
}

.tour-feature-card.danger {
  border-left: 3.5px solid #ef4444;
}

.tour-feature-card.warning {
  border-left: 3.5px solid #f59e0b;
}

.tour-feature-card.reward {
  border-left: 3.5px solid #10b981;
}

.tour-feature-card.sacred {
  border-left: 3.5px solid #38bdf8;
}

.feature-icon-box {
  font-size: 1.35rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.feature-content h4 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  color: #f3e8ff;
  margin: 0 0 4px 0;
}

.feature-content p {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #9ca3af;
  margin: 0;
}

.tour-desc {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tour-main-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #e5e7eb;
  margin: 0;
}

.tour-main-text strong {
  color: #f472b6;
  font-weight: 700;
}

.tour-sub-text {
  font-size: 0.85rem;
  line-height: 1.48;
  color: #9ca3af;
  margin: 0;
}

/* Footer Controls */
.tour-footer {
  padding: 16px 24px;
  background: rgba(14, 11, 24, 0.95);
  border-top: 1px solid rgba(168, 85, 247, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tour-footer-center {
  display: flex;
  align-items: center;
}

.tour-counter-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: #a855f7;
  letter-spacing: 0.5px;
}

.tour-nav-btn {
  padding: 10px 22px;
  font-size: 0.88rem;
  font-weight: 800;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-title);
  letter-spacing: 0.4px;
}

.tour-nav-btn.secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #d1d5db;
}

.tour-nav-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.tour-nav-btn.primary {
  background: linear-gradient(135deg, #9333ea 0%, #7928ca 100%);
  border: 1px solid #c084fc;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(147, 51, 234, 0.45);
}

.tour-nav-btn.primary:hover {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.7);
  transform: translateY(-1px);
}

