/* Urban Shadow Custom Font */
@font-face {
  font-family: 'Urban Shadow';
  src: url('../assets/fonts/Urban Shadow Sans Serif.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
 .scrolling-spawner .creature-item:nth-child(8n+1) {
  animation-delay: 0s;
}

.scrolling-spawner .creature-item:nth-child(8n+2) {
  animation-delay: 2s;
}

.scrolling-spawner .creature-item:nth-child(8n+3) {
  animation-delay: 4s;
}

.scrolling-spawner .creature-item:nth-child(8n+4) {
  animation-delay: 6s;
}

.scrolling-spawner .creature-item:nth-child(8n+5) {
  animation-delay: 8s;
}

.scrolling-spawner .creature-item:nth-child(8n+6) {
  animation-delay: 10s;
}

.scrolling-spawner .creature-item:nth-child(8n+7) {
  animation-delay: 12s;
}

.scrolling-spawner .creature-item:nth-child(8n+8) {
  animation-delay: 14s;
};
}

:root {
  --bg: #24365c;
  --card: #111827;
  --card-light: #1f2937;
  --muted: #9ca3af;
  --text: #e6eef8;
  --accent: #7c3aed;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --border: #374151;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg) url('../assets/images/BRGameBackground.png') center center/cover no-repeat;
  font-family: Inter, system-ui, Segoe UI, Roboto, Arial;
  color: var(--text);
  overflow-x: hidden;
}

/* Typography */
h1, h2 {
  font-family: 'Urban Shadow', Arial, sans-serif !important;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), -1px -1px 0px black, 1px -1px 0px black, -1px 1px 0px black, 1px 1px 0px black;
  margin: 0;
}

h1 {
  font-size: 45px;
}

h2 {
  font-size: 24px;
  margin-bottom: 20px;
}

h3 {
  font-size: 18px;
  margin: 0;
  color: var(--text);
}

/* Login Screen */
.login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  backdrop-filter: blur(10px);
}

.login-card {
  background: var(--card);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.8);
  text-align: center;
  max-width: 800px;
  width: 47.5vw;
}

.login-form {
  margin: 30px 0;
}

.login-form input {
  width: 100%;
  padding: 15px;
  margin-bottom: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-light);
  color: var(--text);
  font-size: 16px;
  text-align: center;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-form button {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.login-form button:hover {
  background: #6d28d9;
  transform: translateY(-2px);
}

.login-form button:disabled {
  background: var(--muted);
  cursor: not-allowed;
  transform: none;
}

.connection-status {
  color: var(--muted);
  font-size: 14px;
  margin-top: 20px;
}

/* Main Game Layout */
.game-interface {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  padding: 20px;
  text-align: center;
  border-bottom: 2px solid var(--border);
}

.header-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 0px;
}

.stat-card {
  background: var(--card-light);
  padding: 15px 25px;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
  min-width: 120px;
}

.main-layout {
  display: grid;
  grid-template-columns: 350px 1fr 300px;
  gap: 20px;
  padding: 20px;
  height: calc(100vh - 200px);
  overflow: hidden;
}

/* Spawner Container */
.spawner-container {
  width: 100%;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  margin: 20px 0;
  padding: 0;
  overflow: hidden;
  position: relative;
  height: 120px; /* Thin height like collection card */
}

.scrolling-spawner {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.scrolling-spawner .creature-item {
  position: absolute;
  white-space: nowrap;
  animation: scrollRight 15s linear forwards;
  background: var(--card-light);
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  margin: 2px;
  min-width: 150px;
  height: auto; /* Let height adjust to content */
  min-height: 40px; /* Minimum height for consistency */
  transform: translateY(-50%);
  right: -250px; /* Start off-screen to the right */
  opacity: 0; /* Start invisible */
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Animation delays are now set directly on elements via JavaScript to avoid nth-child issues when elements are removed */

@keyframes scrollRight {
  0% {
    right: -250px;
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  95% {
    opacity: 1;
  }
  100% {
    right: 100%;
    opacity: 0;
  }
}

/* Panels */
.left-panel, .center-panel, .right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(2, 6, 23, 0.6);
  overflow: hidden;
}

.card-header {
  background: var(--card-light);
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Typography helpers */
.big { font-size: 32px; font-weight: 700; }
.medium { font-size: 18px; font-weight: 600; }
.small { font-size: 14px; }
.muted { color: var(--muted); font-size: 14px; }

/* Creature Lists */
.creature-list, .owned-list {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.creature-item {
  background: var(--card-light);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.creature-item:hover {
  background: #374151;
  /* Removed transform animation that moved creatures on hover */
}

.creature-info {
  flex: 1;
}

.creature-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.creature-rarity {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.creature-price {
  font-size: 14px;
  color: var(--warning);
  margin-top: 5px;
}

.creature-income {
  font-size: 12px;
  color: var(--success);
}

.creature-count {
  background: var(--accent);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
}

/* Rarity colors */
.rarity-common { background: var(--muted); color: white; }
.rarity-rare { background: #3b82f6; color: white; }
.rarity-epic { background: #8b5cf6; color: white; }
.rarity-legendary { background: var(--warning); color: white; }
.rarity-mythic { background: var(--error); color: white; }
.rarity-brainrot-god { background: #ec4899; color: white; }
.rarity-secret { background: var(--success); color: white; }
.rarity-og { background: #f97316; color: white; }

/* Buttons */
.buy-btn, .sell-btn, .upgrade-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.buy-btn {
  background: var(--success);
  color: white;
}

.buy-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}

.buy-btn:disabled {
  background: #374151;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

.sell-btn {
  background: var(--error);
  color: white;
  font-size: 12px;
  padding: 4px 8px;
  margin-left: 10px;
}

.sell-btn:hover {
  background: #dc2626;
}

.upgrade-btn {
  background: var(--success);
  color: white;
}

.upgrade-btn:hover:not(:disabled) {
  background: #059669;
}

.upgrade-btn:disabled {
  background: #374151 !important;
  opacity: 0.7 !important;
  cursor: not-allowed !important;
  color: #9ca3af;
}

/* Upgrades */
.upgrades-grid {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.upgrade-item {
  background: var(--card-light);
  border-radius: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upgrade-info {
  flex: 1;
}

.upgrade-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.upgrade-desc {
  color: var(--muted);
  font-size: 12px;
}

.upgrade-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upgrade-level {
  background: var(--card);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 40px;
  text-align: center;
}

/* Chat */
.chat-panel {
  height: 300px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: var(--card-light);
}

.chat-message {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.chat-player {
  font-weight: 600;
  color: var(--accent);
  font-size: 12px;
}

.chat-text {
  margin-top: 2px;
  font-size: 14px;
}

.chat-input {
  display: flex;
  padding: 15px;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-light);
  color: var(--text);
}

.chat-input input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-input button {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.chat-input button:hover {
  background: #6d28d9;
}

/* Leaderboard */
.leaderboard-list, .players-list {
  padding: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.leaderboard-item, .player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--card-light);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.player-rank {
  background: var(--accent);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.player-name {
  flex: 1;
  margin-left: 10px;
  font-weight: 600;
}

.player-currency {
  color: var(--warning);
  font-weight: 600;
  font-size: 14px;
}

/* Stats */
.stats-grid {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  font-weight: 600;
  color: var(--text);
}

/* Music Player */
.music-card {
  max-height: 200px;
}

.music-player {
  padding: 20px;
}

.music-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.music-info {
  text-align: center;
}

.music-title {
  font-weight: 600;
  margin-bottom: 10px;
}

.music-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.progress-slider, .volume-slider {
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.progress-slider::-webkit-slider-thumb, .volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume-icon {
  font-size: 16px;
}

/* Countdown */
.countdown {
  color: var(--warning);
  font-weight: 600;
  font-size: 14px;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card);
  padding: 30px;
  border-radius: 16px;
  border: 1px solid var(--border);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal-content h3 {
  margin-bottom: 20px;
  color: var(--text);
}

.modal-content button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
}

.modal-content button:hover {
  background: #6d28d9;
}

.offline-earnings {
  margin: 20px 0;
  padding: 20px;
  background: var(--card-light);
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 300px 1fr 250px;
  }
}

@media (max-width: 1000px) {
  .main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  
  .header-stats {
    flex-wrap: wrap;
    gap: 15px;
  }
  
  .stat-card {
    min-width: 100px;
    padding: 10px 15px;
  }
}

@media (max-width: 600px) {
  .main-layout {
    padding: 10px;
    gap: 10px;
  }
  
  h1 {
    font-size: 32px;
  }
  
  h2 {
    font-size: 18px;
  }
  
  .login-card {
    padding: 30px 20px;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--card);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.creature-item, .leaderboard-item, .player-item {
  animation: slideIn 0.3s ease;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}