@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 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; }

body {
  background: #0a0a0f url('/images/menu-bg.png') no-repeat center center fixed;
  background-size: cover;
  color: #ddd;
  font-family: 'Exo 2', 'Montserrat', sans-serif;
  line-height: 1.7;
  margin: 0;
  padding: 10px;
  overflow-x: hidden;
}

body.primal-home {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  padding: 20px;
  overflow-y: auto;
  animation: swirl 60s linear infinite alternate;
  background-size: 150% auto;
}

.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);
}

.top-menu-btn, .ascension-btn, .ascension-cancel-btn, #abilityBtn, #despawnBtn, #siphonBtn, .unleash-btn, #riftPulseBtn, .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, #riftPulseBtn: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, #riftPulseBtn: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; }

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

.container h2 {
  font-size: 1.7em;
  color: #ffcc00;
  border-bottom: 3px solid #ffcc00;
  box-shadow: 0 4px 15px -8px #ffcc00;
  padding-bottom: 10px;
  margin-bottom: 20px;
  text-transform: uppercase;
}

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

.primal-menu-layout {
  display: flex;
  width: 100%;
  max-width: 840px;
  margin-top: 4vh;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.8));
  animation: fadeIn 0.5s;
  position: relative;
  z-index: 10;
}

.menu-shard {
  flex: 1;
  padding: 25px 35px;
  background: var(--elemental-glass);
  border: 1px solid var(--elemental-glow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.menu-shard.snow-shard {
  clip-path: polygon(0 0, 100% 0, calc(100% - 50px) 100%, 0 100%);
  padding-right: 55px;
}

.menu-shard.ash-shard {
  clip-path: polygon(50px 0, 100% 0, 100% 100%, 0 100%);
  padding-left: 55px;
  margin-left: -50px;
}

.game-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 48px;
  letter-spacing: 4px;
  text-align: center;
  position: relative;
  z-index: 10;
  margin-bottom: 20px;
  transition: opacity 0.5s;
  color: #ffcc00;
  text-shadow: 0 0 5px #ffcc00, 0 0 15px #ff8c00;
  opacity: 0;
  background-image: none !important;
  background-clip: unset !important;
  -webkit-background-clip: unset !important;
  animation: none !important;
}

.team-selection h2 {
  font-size: 19px;
  color: #c8bda9;
  margin-bottom: 15px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.teams { margin-bottom: 25px; }

.team-card {
  background: rgba(0,0,0,0.4);
  border: 2px solid var(--elemental-glow, #888); 
  border-radius: 0;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  position: relative;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
  box-shadow: 0 0 12px var(--elemental-glow, #555); 
}

.team-card::after { content: none; }

.team-card:hover {
  transform: scale(1.02);
  background: rgba(255,255,255,0.1);
}

.team-card#team-snow.selected {
  border-color: #7ecbff;
  box-shadow: 0 0 25px rgba(126, 203, 255, 0.7);
  transform: scale(1.02);
  background: rgba(126, 203, 255, 0.2);
}

.team-card#team-ash.selected {
  border-color: #ff6347;
  box-shadow: 0 0 25px rgba(255, 99, 71, 0.7);
  transform: scale(1.02);
  background: rgba(255, 99, 71, 0.2);
}

.team-card img {
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  transition: transform 0.3s;
}

.team-card:hover img {
  transform: scale(1.05);
}

.team-card h3 {
  font-size: 18px;
  margin-top: 10px;
  color: #f0f0f0;
  text-align: center;
  text-transform: uppercase;
}

.start-options, .main-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-btn { margin-bottom: 0; }

#background-effects-canvas {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none;
}

.game-title, .primal-menu-layout, .dark-glass-container { position: relative; z-index: 10; }

@media (max-width: 768px) {
  body.primal-home { background-size: cover;}
  .primal-menu-layout { 
    flex-direction: column; 
    margin: 0 auto;
    max-width: 400px; 
    gap: 15px; 
  }
  .menu-shard.snow-shard, .menu-shard.ash-shard {
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
    padding: 15px;
    margin-left: 0;
  }
  .game-title { font-size: 36px; }
  
  .primal-home > .ui-container {
    max-width: 100% !important; 
    width: 90% !important; 
  }
  
  .team-card img {
    max-height: 140px;
  }
}

@media (max-width: 480px) {
  .game-title { font-size: 30px; }
  .teams { flex-direction: column; align-items: center; gap: 10px; }
  .team-card { width: 100%; padding: 10px; }
  .team-card img { max-height: 120px; }
  .menu-btn { font-size: 14px; padding: 8px; }
}

/* --- Room Code Modal Styles --- */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.modal.hidden { display: none; }

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    padding: 35px;
    border-radius: 12px;
    border: 2px solid #4a4a6a;
    text-align: center;
    max-width: 420px; width: 90%;
    box-shadow: 0 0 25px rgba(0, 204, 255, 0.25);
}

.modal-content h2 {
    color: #fff; margin-top: 0; font-family: 'Cinzel', serif; text-transform: uppercase;
}

.modal-content p { color: #ccc; margin-bottom: 25px; line-height: 1.4; }

#roomCodeInput {
    width: 85%; padding: 12px; font-size: 1.3rem;
    text-align: center; text-transform: uppercase;
    background: rgba(0,0,0,0.6);
    border: 1px solid #00ccff; color: white;
    border-radius: 6px; margin-bottom: 25px;
    letter-spacing: 3px; outline: none;
}
#roomCodeInput:focus { box-shadow: 0 0 10px rgba(0, 204, 255, 0.5); }

.modal-buttons-row { display: flex; gap: 15px; justify-content: center; }
.small-btn { padding: 10px 20px; font-size: 1rem; min-width: 130px; }
.cancel-btn { border-color: #ff4444; color: #ff4444; }
.cancel-btn:hover { background: rgba(255, 68, 68, 0.15); box-shadow: 0 0 15px rgba(255, 68, 68, 0.3); }