/* ---
==========================================================================
   GLOBAL/BASE STYLES (PRIMAL SCROLL THEME)
==========================================================================
--- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=Exo+2:wght@400;600;700&family=Rajdhani:wght@600;700&display=swap');

/* Keyframes */
@keyframes swirl {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 100% 50%;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes dualGlowPulseCyan {

  0%,
  100% {
    filter: blur(5px);
    opacity: 0.8;
  }

  50% {
    filter: blur(8px);
    opacity: 1;
  }
}

@keyframes dualGlowFlickerOrange {

  0%,
  100% {
    filter: blur(6px);
    opacity: 0.7;
  }

  25% {
    filter: blur(8px);
    opacity: 1;
  }

  50% {
    filter: blur(6px);
    opacity: 0.8;
  }

  75% {
    filter: blur(9px);
    opacity: 1;
  }
}

@keyframes swirl-text {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 200% 50%;
  }
}

* {
  box-sizing: border-box;
}

/* Base body style */
body {
  background: #0a0a0f;
  background-size: cover;
  color: #ddd;
  font-family: 'Exo 2', 'Montserrat', sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 8px;
  overflow-x: hidden;
}

/* Rules Page Specific Body */
body.primal-rules {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  padding: 14px;
  overflow-y: auto;
  animation: swirl 60s linear infinite alternate;
  background-size: 150% auto;
}

/* UI Containers - Primal Scroll Aesthetic */
.ui-container {
  --elemental-glow: #888;
  --elemental-text: #f0f0f0;
  --elemental-header: #ffffff;
  background: rgba(10, 5, 5, 0.9);
  border: 1px solid var(--elemental-glow);
  border-radius: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5), 0 0 10px var(--elemental-glow) inset;
  padding: 15px;
  transition: all 0.3s ease;
}

.dark-glass-container {
  --elemental-glow: #777;
  --elemental-glass: rgba(10, 10, 20, 0.9);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  background: var(--elemental-glass);
}

.primal-snow {
  --elemental-glow: #66aaff;
  --elemental-glass: rgba(10, 20, 40, 0.85);
  --elemental-text: #e0f0ff;
  --elemental-header: #ffffff;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
  border: 2px solid var(--elemental-glow);
}

.primal-ash {
  --elemental-glow: #ff6633;
  --elemental-glass: rgba(40, 15, 15, 0.85);
  --elemental-text: #ffe0e0;
  --elemental-header: #ffffff;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 20px 100%, 0 calc(100% - 20px));
  border: 2px solid var(--elemental-glow);
}

/* Buttons - Shared Shard Style */
.top-menu-btn,
.ascension-btn,
.ascension-cancel-btn,
#abilityBtn,
#despawnBtn,
#siphonBtn,
.unleash-btn,
.menu-btn,
.back-btn,
.container button {
  font-family: 'Exo 2', 'Montserrat', sans-serif;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--elemental-glow, #888);
  border-radius: 0;
  color: #f0f0f0;
  padding: 10px 15px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 10px;
  transition: all 0.2s ease;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.top-menu-btn:hover,
.ascension-btn:hover,
#abilityBtn:not(:disabled):hover,
#despawnBtn:not(:disabled):hover,
#siphonBtn:not(:disabled):hover,
.unleash-btn:not(:disabled):hover,
.menu-btn:not(:disabled):hover,
.back-btn:not(:disabled):hover,
.container button:not(:disabled):hover {
  background: var(--elemental-glow, #66aaff);
  color: #111;
  box-shadow: 0 0 15px var(--elemental-glow, #66aaff);
  transform: scale(1.02);
}

#abilityBtn:disabled,
#despawnBtn:disabled,
#siphonBtn:disabled,
.unleash-btn:disabled,
.menu-btn:disabled {
  background: rgba(50, 50, 50, 0.5);
  border-color: #555;
  color: #888;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.ascension-btn {
  font-size: 14px !important;
  padding: 8px 10px !important;
  margin-top: 0 !important;
}

.ascension-cancel-btn {
  background: #332211;
}

/* ---
==========================================================================
   UNIQUE RULES STYLES (for rules.html)
==========================================================================
--- */

.container {
  border-radius: 0;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  padding: 18px 22px;
  max-width: 920px;
  width: 100%;
  margin: 20px auto 160px;
  /* MODIFIED: Ensures space for sticky footer */
  animation: fadeIn 0.5s;
  position: relative;
  z-index: 10;
}

/* Restore a clear border and glass background when using the dark container */
.container.dark-glass-container {
  background: rgba(10, 10, 18, 0.9);
  border: 2px solid rgba(255, 204, 0, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(255, 204, 0, 0.02);
}

.container header {
  text-align: center;
  border-bottom: 1px solid #777;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.container header h1 {
  font-size: 2.1em;
  color: #c8bda9;
  text-shadow: 0 0 10px #ffcc00;
  margin: 0;
  word-wrap: break-word;
  font-family: 'Rajdhani', sans-serif;
}

.container section {
  margin-bottom: 40px;
}

.container h2 {
  font-size: 1.2em;
  color: #ffcc00;
  border-bottom: 3px solid #ffcc00;
  padding-bottom: 10px;
  margin-bottom: 25px;
  text-transform: uppercase;
}

.container h3 {
  font-size: 1.05em;
  color: #c8bda9;
  margin-top: 30px;
  text-transform: uppercase;
}

.container h4 {
  font-size: 1.2em;
  color: #c8bda9;
}

.container ul {
  list-style: none;
  padding-left: 0;
}

.container li {
  margin-bottom: 6px;
  padding-left: 20px;
  position: relative;
  font-size: 0.98em;
}

.container li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: #c8bda9;
  font-size: 1.2em;
  top: -2px;
}

.container b {
  color: #ffcc00;
  font-weight: 600;
}

.container button {
  max-width: 200px;
  margin: 30px auto 0;
  --elemental-glow: #aaa;
}

.ability-split {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
}

.faction-abilities {
  width: 48%;
  padding: 15px 20px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
}

.faction-abilities.primal-snow {
  /* Inherits elemental glass/glow from parent if used as a utility class */
  background: var(--elemental-glass);
  border: 2px solid var(--elemental-glow);
}

.faction-abilities.primal-ash {
  /* Inherits elemental glass/glow from parent if used as a utility class */
  background: var(--elemental-glass);
  border: 2px solid var(--elemental-glow);
}

.faction-abilities h4 {
  color: var(--elemental-glow);
  text-shadow: 0 0 5px var(--elemental-glow);
}

.faction-abilities ul {
  margin-top: 10px;
}

.faction-abilities li {
  font-size: 1em;
}

.unit-category {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid #444;
  padding: 10px;
  margin-bottom: 12px;
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 0 100%);
}

.unit-category h4 {
  margin-top: 0;
  font-size: 1.3em;
  border-bottom: 1px solid #555;
  padding-bottom: 8px;
}

.path-choice {
  margin-bottom: 10px;
  padding: 5px 0;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  padding-left: 10px;
}

.path-choice b {
  color: #c8bda9;
  font-size: 1.1em;
}

/* STICKY FOOTER CONTAINER */
.sticky-footer-btn {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: 15px 0;
  text-align: center;
  background: rgba(0, 0, 0, 0.95);
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
}

/* Neutral Glow for Back Button */
.sticky-footer-btn .back-btn {
  max-width: 250px;
  margin: 0 auto;
  display: block;
  --elemental-glow: #c8c8c8;
  /* Light gray neutral glow base */
}

/* Neutral Hover State */
.sticky-footer-btn .back-btn:hover {
  background: #c8c8c8;
  /* Light gray background on hover */
  color: #111;
  box-shadow: 0 0 15px #c8c8c8;
  /* Neutral glow color */
  transform: scale(1.02);
}


@media (max-width: 768px) {
  body.primal-rules {
    background-size: cover;
  }

  .container {
    padding: 12px 10px;
    margin: 10px auto 100px;
    /* preserves bottom for sticky footer */
  }

  .container header h1 {
    font-size: 2em;
  }

  .container h2 {
    font-size: 1.4em;
  }

  .container h3 {
    font-size: 1.2em;
  }

  .container li {
    font-size: 1em;
    padding-left: 20px;
  }

  .ability-split {
    flex-direction: column;
  }

  .faction-abilities {
    width: 100%;
  }
}

/* Compact collapsible details styling */
details.compact summary {
  cursor: pointer;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 3px;
  margin-bottom: 8px;
  font-weight: 600;
}

details.compact>* {
  padding-left: 6px;
}

details.compact[open] summary {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* Make ascension paths flow into columns for compactness */
.ascension-paths {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

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