/* =========================================================
   FANTASY MATCH: THE SHATTERED REALMS
   Story Mode, Main Menu, Campaign Map & Cinematic Screens
   ========================================================= */

/* Screen Container System */
.game-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  z-index: 10;
  background: #0e0d13;
  overflow-y: auto;
  overflow-x: hidden;
}

.game-screen.active {
  display: flex !important;
}

/* ==================== 1. MAIN MENU SCREEN ==================== */
#screen-main-menu {
  background: 
    radial-gradient(circle at 50% 35%, rgba(108, 92, 231, 0.25) 0%, rgba(14, 13, 19, 0.95) 75%),
    linear-gradient(to bottom, #090710, #141120, #090710);
  align-items: center;
  justify-content: space-between;
  padding: clamp(8px, 1.8vh, 16px) clamp(10px, 3vw, 16px);
  text-align: center;
  overflow: hidden !important;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

.mm-title-container {
  margin-top: 0;
  flex-shrink: 0;
}

.mm-game-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.3rem, 3.6vh, 1.8rem);
  font-weight: 900;
  letter-spacing: clamp(1px, 0.5vw, 2px);
  background: linear-gradient(135deg, #fff 0%, #ffeaa7 50%, #f39c12 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(243, 156, 18, 0.4);
  line-height: 1.15;
}

.mm-subtitle {
  font-family: 'MedievalSharp', cursive;
  font-size: clamp(0.7rem, 1.8vh, 0.92rem);
  color: #a29bfe;
  letter-spacing: clamp(1px, 0.5vw, 3px);
  margin-top: 2px;
  text-transform: uppercase;
}

/* Profile Banner on Main Menu */
.mm-profile-card {
  width: 100%;
  background: rgba(30, 24, 45, 0.7);
  border: 1px solid rgba(243, 156, 18, 0.3);
  border-radius: 8px;
  padding: clamp(4px, 1vh, 8px) clamp(8px, 2vw, 14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  margin: clamp(3px, 0.8vh, 8px) 0;
  flex-shrink: 0;
  box-sizing: border-box;
}

.mm-profile-left {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 10px);
}

.mm-avatar {
  width: clamp(28px, 4.8vh, 36px);
  height: clamp(28px, 4.8vh, 36px);
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #1e272e;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mm-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mm-hero-info {
  text-align: left;
}

.mm-hero-name {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.78rem, 1.8vh, 0.95rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.mm-hero-level {
  font-size: clamp(0.64rem, 1.4vh, 0.75rem);
  color: var(--gold-glow);
  line-height: 1.2;
}

.mm-gold-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid rgba(243, 156, 18, 0.4);
  font-family: 'Cinzel', serif;
  font-size: clamp(0.74rem, 1.6vh, 0.85rem);
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}

/* Center Crystal & Animation */
.mm-centerpiece {
  position: relative;
  width: clamp(75px, 15vh, 155px);
  height: clamp(75px, 15vh, 155px);
  margin: clamp(2px, 0.6vh, 8px) auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 1;
}

.mm-crystal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: crystalFloat 4s ease-in-out infinite;
}

.mm-slogan-text {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.58rem, 1.4vh, 0.72rem);
  color: #a4b0be;
  letter-spacing: clamp(0.5px, 0.3vw, 1px);
  flex-shrink: 0;
  margin-top: 1px;
}

@keyframes crystalFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 0 15px rgba(162, 155, 254, 0.6));
  }
  50% {
    transform: translateY(-8px) scale(1.03);
    filter: drop-shadow(0 0 25px rgba(224, 86, 253, 0.9));
  }
}

/* Main Menu Navigation Buttons */
.mm-actions-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vh, 8px);
  margin: clamp(4px, 0.8vh, 8px) 0;
  flex-shrink: 0;
}

.mm-btn-primary {
  width: 100%;
  padding: clamp(7px, 1.3vh, 11px) 14px;
  border-radius: 8px;
  font-family: 'Cinzel', serif;
  font-size: clamp(0.78rem, 2vh, 0.95rem);
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  box-sizing: border-box;
}

.mm-btn-primary.continue {
  background: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
  color: #fff;
  border: 1px solid #ffeaa7;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.mm-btn-primary.continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.6);
}

.mm-btn-primary.story {
  background: linear-gradient(135deg, #6c5ce7 0%, #4834d4 100%);
  color: #fff;
  border: 1px solid #a29bfe;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.mm-btn-primary.story:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
}

.mm-btn-primary.endless {
  background: linear-gradient(135deg, #2c3e50 0%, #1e272e 100%);
  color: #dfe4ea;
  border: 1px solid #57606f;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.mm-btn-primary.endless:hover {
  background: linear-gradient(135deg, #34495e 0%, #2f3542 100%);
  transform: translateY(-2px);
}

/* Secondary Hub Navigation Grid - Single Row Compact 6 Columns */
.mm-sub-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(3px, 0.8vw, 6px);
  width: 100%;
  margin-top: clamp(2px, 0.6vh, 6px);
  flex-shrink: 0;
  box-sizing: border-box;
}

.mm-sub-btn {
  background: rgba(28, 24, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: clamp(3px, 0.7vh, 6px) 2px;
  color: #dfe4ea;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: clamp(0.52rem, 1.3vh, 0.65rem);
  font-family: 'Cinzel', serif;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
  min-width: 0;
}

.mm-sub-btn span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mm-sub-btn:hover {
  background: rgba(45, 38, 55, 0.95);
  border-color: var(--gold);
  color: var(--gold-glow);
  transform: translateY(-2px);
}

.mm-sub-btn span.icon {
  font-size: clamp(0.9rem, 2.2vh, 1.15rem);
  line-height: 1;
}

/* Short Screen Responsive Adaptations */
@media (max-height: 640px) {
  #screen-main-menu {
    padding: 6px 10px;
  }

  .mm-title-container {
    margin-top: 0;
  }

  .mm-centerpiece {
    width: 70px;
    height: 70px;
    margin: 1px auto;
  }

  .mm-profile-card {
    padding: 3px 8px;
    margin: 2px 0;
  }

  .mm-actions-container {
    gap: 3px;
    margin: 2px 0;
  }

  .mm-btn-primary {
    padding: 5px 10px;
    font-size: 0.74rem;
  }

  .mm-sub-btn {
    padding: 2px 1px;
  }
}

/* ==================== CREDITS MODAL ==================== */
.credits-modal-window {
  max-width: 520px;
  max-height: 88vh;
  background: linear-gradient(160deg, #1f182c 0%, #110d1c 100%);
  border: 2px solid #f1c40f;
  border-radius: 14px;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.9), 0 0 25px rgba(241, 196, 15, 0.25);
}

.credits-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: calc(88vh - 70px);
}

.credits-section-card {
  background: rgba(25, 20, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.dev-profile-card {
  background: linear-gradient(135deg, rgba(46, 20, 75, 0.7) 0%, rgba(20, 15, 34, 0.9) 100%);
  border: 1.5px solid rgba(241, 196, 15, 0.45);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.credits-badge-icon {
  font-size: 2.2rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 196, 15, 0.25) 0%, rgba(35, 25, 55, 0.8) 70%);
  border: 2px solid #f1c40f;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(241, 196, 15, 0.35);
  flex-shrink: 0;
}

.credits-dev-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.credits-dev-course {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: #ff7675;
  font-weight: 700;
}

.credits-dev-name {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  color: #f1c40f;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.credits-dev-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.meta-pill {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 8px;
  color: #e4e7eb;
}

.meta-pill strong {
  color: #74b9ff;
}

.credits-section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: #f1c40f;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(241, 196, 15, 0.25);
  padding-bottom: 4px;
}

.credits-text {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #bdc3c7;
  margin: 0;
  text-align: left;
}

.credits-source-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credits-source-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(15, 12, 22, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
}

.credits-source-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 700;
  color: #2ed573;
  letter-spacing: 0.5px;
}

.credits-source-desc {
  font-size: 0.76rem;
  line-height: 1.45;
  color: #ced6e0;
}

.credits-source-desc strong {
  color: #f1f2f6;
}

.credits-source-desc code {
  background: rgba(0, 0, 0, 0.4);
  color: #eccc68;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.74rem;
}


/* ==================== 2. STORY CAMPAIGN MAP SCREEN ==================== */
#screen-story-map {
  background: #090710;
  padding: 0;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.map-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px clamp(8px, 2.5vw, 14px);
  gap: clamp(6px, 1.8vw, 12px);
  background: linear-gradient(180deg, rgba(13, 10, 20, 0.98) 0%, rgba(13, 10, 20, 0.9) 85%, transparent 100%);
  border-bottom: 1px solid rgba(243, 156, 18, 0.25);
  backdrop-filter: blur(6px);
  box-sizing: border-box;
  width: 100%;
  flex-shrink: 0;
}

.map-back-btn {
  background: rgba(28, 22, 38, 0.85);
  border: 1px solid rgba(243, 156, 18, 0.35);
  color: #dfe4ea;
  border-radius: 6px;
  padding: 5px clamp(8px, 1.8vw, 12px);
  font-family: 'Cinzel', serif;
  font-size: clamp(0.7rem, 2vw, 0.78rem);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.map-back-btn:hover {
  background: rgba(243, 156, 18, 0.25);
  border-color: var(--gold);
  color: #fff;
  transform: translateY(-1px);
}

/* Medieval Ribbon Banner */
.map-ribbon-banner {
  background: linear-gradient(180deg, #b71540 0%, #781028 100%);
  border: 1.5px solid #f39c12;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 4px clamp(8px, 2.2vw, 16px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.map-ribbon-text {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.76rem, 2.4vw, 0.92rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: clamp(0.6px, 0.2vw, 1.4px);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  line-height: 1.2;
}

.map-progress-pill {
  background: rgba(108, 92, 231, 0.25);
  border: 1px solid #a29bfe;
  color: #a29bfe;
  padding: 4px clamp(7px, 1.8vw, 11px);
  border-radius: 12px;
  font-size: clamp(0.66rem, 1.9vw, 0.74rem);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Scrollable Winding Saga Map Viewport */
.saga-map-viewport {
  flex: 1;
  width: 100%;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  background: #090710;
}

.saga-map-canvas {
  position: relative;
  width: 100%;
  min-height: 980px;
  background: linear-gradient(to top, 
    #173322 0%,      /* Stage 1-2: Enchanted Forest Grass/Soil */
    #25442f 14%,
    #3b2f1f 26%,     /* Stage 3-4: Graveyard / Ancient Ruins Soil */
    #2a2033 40%,
    #422129 52%,     /* Stage 5: Volcanic Mountain & Dragon Cavern */
    #152e45 65%,     /* Stage 6: Frozen Kingdom Snow & Glaciers */
    #24132b 78%,     /* Stage 7-8: Dark Obsidian Fortress */
    #12091a 90%,     /* Stage 9-10: Abyssal Rift & The Shattered Throne */
    #08040d 100%
  );
  overflow: hidden;
}

.saga-path-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.saga-nodes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  pointer-events: auto;
}

/* Stage Node Button */
.saga-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
  user-select: none;
}

.saga-node:hover {
  transform: translate(-50%, -50%) scale(1.15);
  z-index: 25;
}

/* Completed Stage */
.saga-node.completed {
  background: radial-gradient(circle, #27ae60 0%, #1e824c 80%);
  border: 3.5px solid #ffd700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7), 0 0 10px rgba(46, 204, 113, 0.5);
  color: #fff;
}

.saga-node-check {
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Current / Available Stage */
.saga-node.available {
  background: radial-gradient(circle, #f39c12 0%, #d35400 85%);
  border: 3.5px solid #fff;
  box-shadow: 0 0 20px rgba(243, 156, 18, 0.85), 0 4px 10px rgba(0, 0, 0, 0.8);
  color: #fff;
  animation: sagaNodePulse 1.8s infinite ease-in-out;
}

@keyframes sagaNodePulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 14px rgba(243, 156, 18, 0.7), 0 4px 10px rgba(0, 0, 0, 0.8);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 0 26px rgba(255, 234, 167, 1), 0 6px 14px rgba(0, 0, 0, 0.9);
  }
}

/* Locked Stage */
.saga-node.locked {
  background: radial-gradient(circle, #3d3b45 0%, #201e26 80%);
  border: 3px solid #575263;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.7);
  color: #7f7a8c;
  cursor: not-allowed;
  opacity: 0.82;
}

/* Boss Stage (Stage 5 and 10) */
.saga-node.boss {
  width: 62px;
  height: 62px;
  border-width: 4px;
}

.saga-node.boss.completed {
  background: radial-gradient(circle, #8e44ad 0%, #582173 80%);
  border-color: #ffd700;
  box-shadow: 0 0 18px rgba(155, 89, 182, 0.7);
}

.saga-node.boss.available {
  background: radial-gradient(circle, #c0392b 0%, #7d150b 80%);
  border-color: #ff7675;
  box-shadow: 0 0 24px rgba(231, 76, 60, 0.9);
  animation: sagaBossPulse 1.6s infinite ease-in-out;
}

@keyframes sagaBossPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.14); box-shadow: 0 0 32px rgba(255, 107, 107, 1); }
}

/* Selected Node Ring */
.saga-node.selected {
  outline: 4px solid #55efc4;
  outline-offset: 3px;
}

/* Stage Number inside Node */
.saga-node-num {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.saga-node.boss .saga-node-num {
  font-size: 1.45rem;
}

/* Stage Label under Node */
.saga-node-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 5px;
  background: rgba(10, 8, 15, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 700;
  color: #dfe4ea;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.saga-node.completed .saga-node-label {
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.45);
}

.saga-node.available .saga-node-label {
  color: #f39c12;
  border-color: var(--gold);
}

/* Floating Hero Avatar Marker (Like Reference Image) */
.saga-hero-token {
  position: absolute;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 4px;
  animation: heroTokenBounce 1.5s ease-in-out infinite;
  pointer-events: none;
}

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

.saga-hero-token-bubble {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e272e 0%, #0abde3 100%);
  border: 2.5px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.85), 0 0 12px rgba(10, 189, 227, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 1.6rem;
}

.saga-hero-token-bubble img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.saga-hero-token-pointer {
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}

/* Floating Stage Preview Drawer (Bottom Sheet) */
.stage-preview-drawer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(25, 20, 36, 0.98) 0%, rgba(15, 12, 22, 0.98) 100%);
  border-top: 2px solid var(--gold);
  box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.85);
  padding: clamp(8px, 1.5vh, 12px) clamp(10px, 3vw, 16px);
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 1vh, 8px);
  z-index: 50;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.spd-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

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

.spd-stage-num {
  font-size: 0.68rem;
  font-family: 'Cinzel', serif;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 1px;
}

.spd-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.88rem, 2.4vw, 1.05rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.spd-close-btn {
  background: transparent;
  border: none;
  color: #a4b0be;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.spd-close-btn:hover {
  color: #fff;
}

.spd-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: clamp(0.74rem, 1.8vw, 0.84rem);
  color: #dfe4ea;
}

.spd-enemy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.35);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
}

.spd-rewards-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Cinzel', serif;
  font-size: 0.76rem;
  color: var(--gold);
}

.spd-btn-start {
  width: 100%;
  padding: clamp(8px, 1.4vh, 11px) 0;
  background: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: clamp(0.85rem, 2.2vw, 0.98rem);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.45);
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
}

.spd-btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.65);
}


/* ==================== 3. STORY DIALOGUE SCREEN ==================== */
#screen-story-dialogue {
  background: 
    radial-gradient(circle at 50% 40%, rgba(30, 20, 50, 0.8) 0%, rgba(9, 7, 16, 0.98) 80%);
  padding: 18px 16px;
  justify-content: space-between;
}

.dia-stage-title-banner {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--gold-glow);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  padding: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  border: 1px solid rgba(243, 156, 18, 0.2);
}

.dia-portrait-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 18px 0;
}

.dia-portrait-frame {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: #141120;
  box-shadow: 0 0 25px rgba(243, 156, 18, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: portraitBreathing 3s ease-in-out infinite;
}

@keyframes portraitBreathing {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.dia-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dia-speaker-tag {
  margin-top: 10px;
  background: rgba(243, 156, 18, 0.2);
  border: 1px solid var(--gold);
  color: var(--gold-glow);
  padding: 4px 14px;
  border-radius: 14px;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.dia-dialogue-box {
  background: rgba(22, 17, 32, 0.95);
  border: 2px solid var(--panel-border-inner);
  border-radius: 12px;
  padding: 16px 18px;
  min-height: 110px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.8);
  font-size: 1rem;
  line-height: 1.5;
  color: #f5f6fa;
  font-family: 'Nunito', sans-serif;
  text-align: left;
  position: relative;
}

.dia-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 12px;
}

.dia-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.dia-btn.skip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #a4b0be;
}

.dia-btn.skip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.dia-btn.next {
  background: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
  border: 1px solid #ffeaa7;
  color: #fff;
  flex: 1;
  text-align: center;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.dia-btn.next:hover {
  transform: translateY(-2px);
}


/* ==================== 4. STORY ENDING & EPILOGUE SCREEN ==================== */
#screen-story-ending, #screen-epilogue {
  background: 
    radial-gradient(circle at 50% 30%, rgba(108, 92, 231, 0.3) 0%, rgba(14, 13, 19, 0.98) 75%);
  padding: 24px 18px;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.ending-title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffeaa7 0%, #f39c12 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.ending-narrative {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #dfe4ea;
  background: rgba(20, 16, 30, 0.85);
  border: 1px solid rgba(243, 156, 18, 0.3);
  border-radius: 10px;
  padding: 14px;
  margin: 12px 0;
  text-align: justify;
}

.epilogue-stats-card {
  width: 100%;
  background: rgba(26, 21, 38, 0.9);
  border: 1px solid rgba(243, 156, 18, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  text-align: left;
}

.epilogue-stat-row {
  display: flex;
  justify-content: space-between;
  color: #dfe4ea;
}

.epilogue-rewards-box {
  width: 100%;
  background: rgba(45, 34, 18, 0.4);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}


/* ==================== 5. IN-GAME PAUSE MENU BUTTON & MODAL ==================== */
.battle-pause-btn {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #dfe4ea;
  padding: 4px 10px;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.battle-pause-btn:hover {
  background: rgba(243, 156, 18, 0.25);
  border-color: var(--gold);
  color: #fff;
}

.pause-menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.pause-menu-item {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  background: #231c30;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
}

.pause-menu-item:hover {
  background: #332747;
  border-color: var(--gold);
  transform: translateY(-2px);
}

.pause-menu-item.resume {
  background: linear-gradient(135deg, #27ae60 0%, #1e824c 100%);
  border-color: #55efc4;
}

.pause-menu-item.main-menu {
  background: linear-gradient(135deg, #c0392b 0%, #962d22 100%);
  border-color: #ff7675;
}

/* ==================== PROLOGUE MODAL CINEMATIC ==================== */
#modal-story {
  z-index: 120 !important;
  background: rgba(5, 3, 10, 0.94);
  backdrop-filter: blur(8px);
}

#modal-story .modal-window {
  max-width: 520px;
  background: linear-gradient(135deg, #1c152a 0%, #110d1a 100%);
  border: 2px solid var(--gold);
  box-shadow: 0 0 35px rgba(243, 156, 18, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.8);
  border-radius: 14px;
}

#story-typewriter-text {
  font-family: 'MedievalSharp', cursive;
  font-size: 1.1rem;
  line-height: 1.7;
  min-height: 140px;
  color: #f1f2f6;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  padding: 8px 12px;
}

