﻿/* ========== MAIN CONTAINER ========== */
/* Force scroll on mobile for codex page */
html,
body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: 100%;
  min-height: 100vh;
  position: relative;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.codex-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 6rem 1rem 2rem 1rem;
  box-sizing: border-box;
  width: 100%;
  position: relative;
  animation: containerFadeIn 0.8s ease-out;
}

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

/* background effects with animated gradients */
.codex-container::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(
      circle at 20% 30%,
      rgba(77, 212, 255, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(255, 215, 0, 0.06) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 80%,
      rgba(147, 112, 219, 0.06) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: -1;
  animation: backgroundPulse 8s ease-in-out infinite;
}

@keyframes backgroundPulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* ========== PAGE HEADER ========== */
.codex-header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.codex-header::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-blue),
    transparent
  );
  border-radius: 2px;
  box-shadow: 0 0 20px var(--glow-blue);
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 0 20px var(--glow-blue);
  }
  50% {
    box-shadow:
      0 0 30px var(--glow-blue),
      0 0 40px rgba(77, 212, 255, 0.4);
  }
}

.page-title {
  position: relative;
  display: inline-block;
  background: linear-gradient(135deg, #4dd4ff, #9370db, #ffd700);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 5s ease infinite;
  filter: drop-shadow(0 0 20px rgba(77, 212, 255, 0.5));
}

.page-title::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 212, 255, 0.6),
    transparent
  );
  border-radius: 1px;
  animation: expandWidth 1s ease-out;
}

@keyframes expandWidth {
  from {
    width: 0%;
  }
  to {
    width: 60%;
  }
}

.page-subtitle {
  animation: fadeIn 1s ease-out 0.3s backwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========== STATISTICS CARDS ========== */
.codex-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
  box-sizing: border-box;
  animation: statsSlideUp 0.8s ease-out 0.2s backwards;
}

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

.stat-card {
  background: linear-gradient(
    145deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  );
  border: 2px solid rgba(77, 212, 255, 0.4);
  border-radius: 20px;
  padding: 1.8rem 1.2rem;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.21, 1);
  position: relative;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 130px;
  cursor: pointer;
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(77, 212, 255, 0.2);
  animation: cardPopIn 0.5s ease-out backwards;
  animation-delay: calc(var(--card-index, 0) * 0.1s);
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
  transition: all 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(77, 212, 255, 0.4));
}

.stat-card:hover .stat-icon {
  transform: scale(1.15) translateY(-5px);
  opacity: 1;
  filter: drop-shadow(0 0 15px rgba(77, 212, 255, 0.6));
}

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

.stat-card:nth-child(1) {
  --card-index: 0;
}
.stat-card:nth-child(2) {
  --card-index: 1;
}
.stat-card:nth-child(3) {
  --card-index: 2;
}
.stat-card:nth-child(4) {
  --card-index: 3;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(77, 212, 255, 0.05),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    rgba(77, 212, 255, 0.1),
    rgba(255, 215, 0, 0.1),
    rgba(147, 112, 219, 0.1),
    rgba(77, 212, 255, 0.1)
  );
  border-radius: 17px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: borderGlow 3s linear infinite;
}

@keyframes borderGlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-card:hover {
  transform: translateY(-8px) scale(1.05);
  border-color: var(--primary-blue);
  box-shadow:
    0 15px 50px rgba(77, 212, 255, 0.4),
    0 0 30px rgba(77, 212, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stat-number {
  font-size: 2.8rem;
  font-weight: bold;
  background: linear-gradient(135deg, #4dd4ff, #2a9fd8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  font-family: "Cinzel", serif;
  transition: all 0.3s ease;
  position: relative;
  animation: countUp 1s ease-out;
  filter: drop-shadow(0 0 12px rgba(77, 212, 255, 0.5));
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.stat-card:hover .stat-number {
  transform: scale(1.1);
  filter: drop-shadow(0 0 20px rgba(77, 212, 255, 0.7));
}

.stat-label {
  color: rgba(232, 240, 255, 0.8);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.stat-card:hover .stat-label {
  color: rgba(232, 240, 255, 1);
  transform: translateY(-2px);
}

/* ========== FILTER CONTROLS ========== */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.advanced-filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.filter-select {
  padding: 0.8rem 1.2rem;
  background: rgba(21, 25, 35, 0.8);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(77, 212, 255, 0.3);
  border-radius: 20px;
  color: var(--text-light);
  font-size: 0.9rem;
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  min-width: 150px;
}

.filter-select:focus,
.filter-select:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 0 15px rgba(77, 212, 255, 0.3);
  background: rgba(21, 25, 35, 0.9);
}

.filter-select option {
  background: rgba(21, 25, 35, 0.95);
  color: var(--text-light);
  padding: 0.5rem;
}

.clear-filters-btn {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(
    135deg,
    rgba(255, 87, 87, 0.2),
    rgba(255, 87, 87, 0.1)
  );
  border: 2px solid rgba(255, 87, 87, 0.4);
  border-radius: 20px;
  color: #ff5757;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Rajdhani", sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.clear-filters-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 87, 87, 0.3),
    rgba(255, 87, 87, 0.2)
  );
  border-color: #ff5757;
  box-shadow: 0 0 15px rgba(255, 87, 87, 0.3);
  transform: translateY(-2px);
}

/* ========== SEARCH FUNCTIONALITY ========== */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(21, 25, 35, 0.95);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(77, 212, 255, 0.3);
  border-top: none;
  border-radius: 0 0 15px 15px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.search-suggestion {
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(77, 212, 255, 0.1);
}

.search-suggestion:hover {
  background: rgba(77, 212, 255, 0.1);
  color: var(--primary-blue);
}

.search-suggestion:last-child {
  border-bottom: none;
}

/* ========== CHARACTER DISPLAY ========== */
.character-display {
  position: relative;
}

/* ========== CHARACTER MODAL ========== */
.character-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.character-modal.active {
  display: flex;
}

.modal-content {
  background: linear-gradient(
    145deg,
    rgba(21, 25, 35, 0.98),
    rgba(35, 53, 80, 0.96)
  );
  border: 2px solid rgba(77, 212, 255, 0.5);
  border-radius: 24px;
  padding: 0;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  margin: 1rem;
  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(77, 212, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.modal-close:hover {
  background: rgba(255, 87, 87, 0.2);
  border-color: #ff5757;
  color: #ff5757;
  transform: rotate(90deg) scale(1.1);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  max-height: 85vh;
}

.modal-character-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(77, 212, 255, 0.2);
}

.modal-character-image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(77, 212, 255, 0.6);
  box-shadow: 0 0 30px rgba(77, 212, 255, 0.4);
  position: relative;
}

.modal-character-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.modal-character-info h2 {
  color: var(--primary-blue);
  margin: 0 0 0.5rem 0;
  font-family: "Cinzel", serif;
  font-size: 2rem;
  text-shadow: 0 0 20px var(--glow-blue);
}

.modal-character-subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.modal-power-badge {
  display: inline-block;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.9),
    rgba(255, 215, 0, 0.8)
  );
  color: #1a1a1a;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.modal-section {
  margin-bottom: 2rem;
}

.modal-section h3 {
  color: var(--primary-blue);
  font-family: "Cinzel", serif;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px var(--glow-blue);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-section h3::before {
  content: "";
  width: 4px;
  height: 20px;
  background: var(--primary-blue);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--glow-blue);
}

.modal-description {
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.modal-abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.modal-ability-tag {
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.15),
    rgba(66, 159, 216, 0.1)
  );
  border: 1px solid rgba(77, 212, 255, 0.4);
  color: var(--primary-blue);
  padding: 0.5rem 1rem;
  border-radius: 15px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.modal-ability-tag:hover {
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.25),
    rgba(66, 159, 216, 0.2)
  );
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(77, 212, 255, 0.3);
}

.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.modal-stat-card {
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.8),
    rgba(35, 53, 80, 0.6)
  );
  border: 1px solid rgba(77, 212, 255, 0.3);
  border-radius: 15px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.modal-stat-card:hover {
  border-color: var(--primary-blue);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(77, 212, 255, 0.2);
}

.modal-stat-label {
  color: var(--primary-blue);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.modal-stat-value {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2rem;
  font-weight: bold;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(77, 212, 255, 0.2);
}

.modal-action-btn {
  background: linear-gradient(135deg, var(--primary-blue), #2a9fd8);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(77, 212, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 160px;
}

.modal-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(77, 212, 255, 0.4);
  background: linear-gradient(135deg, #2a9fd8, var(--primary-blue));
}

/* ========== LORE SECTION ========== */
.lore-section {
  margin-top: 4rem;
  padding: 3rem 0;
  border-top: 2px solid rgba(77, 212, 255, 0.3);
  position: relative;
}

.lore-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 2px;
  background: var(--primary-blue);
  box-shadow: 0 0 10px var(--glow-blue);
}

.section-title {
  font-family: "Cinzel", serif;
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-blue);
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 0 20px var(--glow-blue);
}

.lore-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.lore-card {
  background: linear-gradient(
    145deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  );
  backdrop-filter: blur(20px);
  border: 2px solid rgba(77, 212, 255, 0.4);
  border-radius: 20px;
  padding: 2rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.lore-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(77, 212, 255, 0.05),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lore-card:hover::before {
  opacity: 1;
}

.lore-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--primary-blue);
  box-shadow:
    0 15px 40px rgba(77, 212, 255, 0.35),
    0 0 25px rgba(77, 212, 255, 0.2);
}

.lore-card h3 {
  font-family: "Cinzel", serif;
  font-size: 1.4rem;
  color: var(--primary-blue);
  margin-bottom: 1rem;
  text-shadow: 0 0 10px var(--glow-blue);
}

.lore-card p {
  color: rgba(232, 240, 255, 0.8);
  line-height: 1.6;
  font-size: 0.95rem;
}

/* ========== SEARCH CONTAINER ========== */
.codex-controls {
  margin-bottom: 3rem;
  animation: controlsSlideIn 0.8s ease-out 0.4s backwards;
}

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

.search-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
}

.search-container::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  height: 60px;
  background: radial-gradient(
    ellipse,
    rgba(77, 212, 255, 0.15),
    transparent 70%
  );
  border-radius: 30px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.search-container.focused::before {
  opacity: 1;
  animation: searchGlow 2s ease-in-out infinite;
}

@keyframes searchGlow {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
}

.search-input {
  width: 100%;
  max-width: 500px;
  padding: 1.2rem 2rem 1.2rem 3rem;
  background: rgba(21, 25, 35, 0.92);
  border: 2px solid rgba(77, 212, 255, 0.4);
  border-radius: 30px;
  color: var(--text-light);
  font-size: 1rem;
  font-family: "Rajdhani", sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.21, 1);
  outline: none;
  text-align: left;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-input::before {
  content: "🔍";
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: rgba(77, 212, 255, 0.6);
  pointer-events: none;
}

.search-container::after {
  content: "🔍";
  position: absolute;
  left: calc(50% - 230px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: rgba(77, 212, 255, 0.6);
  pointer-events: none;
  z-index: 2;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--primary-blue);
  box-shadow:
    0 0 25px rgba(77, 212, 255, 0.5),
    0 0 50px rgba(77, 212, 255, 0.3),
    0 8px 30px rgba(0, 0, 0, 0.4),
    inset 0 0 20px rgba(77, 212, 255, 0.12);
  background: rgba(21, 25, 35, 0.98);
  transform: scale(1.02) translateY(-2px);
  padding-left: 3rem;
}

.search-input:focus + .search-container::after {
  color: var(--primary-blue);
  transform: translateY(-50%) scale(1.08);
}

.search-input::placeholder {
  color: rgba(232, 240, 255, 0.5);
}

/* ========== FILTER TABS ========== */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  margin-bottom: 1rem;
}

.filter-tabs::before {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 212, 255, 0.3),
    transparent
  );
  border-radius: 1px;
}

.filter-tab {
  padding: 1rem 1.8rem;
  background: rgba(33, 39, 97, 0.7);
  border: 2px solid rgba(77, 212, 255, 0.4);
  border-radius: 25px;
  color: rgba(232, 240, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Rajdhani", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.21, 1);
  outline: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.filter-tab::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 212, 255, 0.15),
    transparent
  );
  transition: left 0.5s ease;
}

.filter-tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary-blue);
  border-radius: 1px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--glow-blue);
}

.filter-tab:hover::before {
  left: 100%;
}

.filter-tab:hover {
  border-color: rgba(77, 212, 255, 0.7);
  color: var(--primary-blue);
  background: rgba(33, 39, 97, 0.9);
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 8px 25px rgba(77, 212, 255, 0.35),
    0 0 15px rgba(77, 212, 255, 0.2);
}

.filter-tab:hover::after {
  width: 70%;
}

.filter-tab.active {
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.25),
    rgba(77, 212, 255, 0.18)
  );
  border-color: var(--primary-blue);
  color: #ffffff;
  box-shadow:
    0 0 25px rgba(77, 212, 255, 0.4),
    0 8px 25px rgba(77, 212, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-3px) scale(1.05);
}

.filter-tab.active::after {
  width: 80%;
  height: 3px;
  box-shadow: 0 0 15px var(--glow-blue);
}

/* ========== CHARACTER GRID ========== */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  justify-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  transition: opacity 0.3s ease;
}

.character-grid::before {
  content: "";
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 212, 255, 0.3),
    rgba(255, 215, 0, 0.3),
    rgba(147, 112, 219, 0.3),
    rgba(77, 212, 255, 0.3),
    transparent
  );
  border-radius: 2px;
  animation: gridGlow 3s ease-in-out infinite;
}

@keyframes gridGlow {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.character-grid::after {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 2px;
  background: var(--primary-blue);
  border-radius: 1px;
  box-shadow: 0 0 15px var(--glow-blue);
}

/* Standard 4-column grid for desktop */
@media (min-width: 1200px) {
  .character-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }
}

/* 3-column grid for tablets */
@media (min-width: 768px) and (max-width: 1199px) {
  .character-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

/* ========== CHARACTER CARDS ========== */
.character-card {
  background: linear-gradient(
    145deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  );
  border: 2px solid rgba(77, 212, 255, 0.4);
  border-radius: 20px;
  padding: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.21, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(77, 212, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 320px;
  min-height: 460px;
  display: flex;
  flex-direction: column;
  animation: cardFadeIn 0.6s ease-out backwards;
  contain: layout style paint;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.character-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(77, 212, 255, 0.05),
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.character-card:hover::before {
  opacity: 1;
}

.character-card::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(
    45deg,
    rgba(77, 212, 255, 0.2),
    rgba(255, 215, 0, 0.2),
    rgba(147, 112, 219, 0.2),
    rgba(77, 212, 255, 0.2)
  );
  background-size: 400% 400%;
  border-radius: 23px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.character-card:hover::after {
  opacity: 1;
}

.character-card.character-themed {
  border: 2px solid var(--character-primary);
  background: linear-gradient(
    145deg,
    rgba(var(--character-primary-rgb), 0.08),
    rgba(var(--character-secondary-rgb), 0.05)
  );
  box-shadow: 0 8px 32px rgba(var(--character-primary-rgb), 0.2);
}

.character-card.character-themed::before {
  background: radial-gradient(
    circle at 30% 30%,
    rgba(var(--character-primary-rgb), 0.1),
    transparent 70%
  );
  opacity: 1;
}

.character-card.character-themed > * {
  position: relative;
  z-index: 1;
}

.character-card:hover {
  transform: translateY(-12px) scale(1.03);
  border-color: var(--primary-blue);
  box-shadow:
    0 20px 60px rgba(77, 212, 255, 0.4),
    0 0 40px rgba(77, 212, 255, 0.3),
    0 0 0 2px rgba(77, 212, 255, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.character-card.character-themed:hover {
  transform: translateY(-12px) scale(1.03);
  border-color: var(--character-primary);
  box-shadow:
    0 20px 60px rgba(var(--character-primary-rgb), 0.4),
    0 0 40px rgba(var(--character-primary-rgb), 0.3),
    0 0 0 1px rgba(var(--character-primary-rgb), 0.3);
  z-index: 10;
}

/* ========== CHARACTER CARD HEADER ========== */
.character-header {
  position: relative;
  height: 200px;
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.1),
    rgba(66, 159, 216, 0.05)
  );
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.character-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 50% 30%,
    rgba(77, 212, 255, 0.15),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.character-card:hover .character-header::before {
  opacity: 1;
}

.character-status-badge {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.95),
    rgba(66, 159, 216, 0.9)
  );
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 14px;
  font-size: 0.6rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  box-shadow:
    0 4px 15px rgba(77, 212, 255, 0.5),
    0 0 10px rgba(77, 212, 255, 0.3);
  z-index: 3;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  left: auto;
}

.character-card:hover .character-status-badge {
  transform: translateY(-3px) scale(1.08);
  box-shadow:
    0 8px 25px rgba(77, 212, 255, 0.7),
    0 0 20px rgba(77, 212, 255, 0.5);
}

.character-power-indicator {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.95),
    rgba(255, 215, 0, 0.9)
  );
  color: #1a1a1a;
  padding: 0.3rem 0.6rem;
  border-radius: 14px;
  font-size: 0.6rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow:
    0 4px 15px rgba(255, 215, 0, 0.5),
    0 0 10px rgba(255, 215, 0, 0.3);
  z-index: 3;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.character-card:hover .character-power-indicator {
  transform: translateY(-3px) scale(1.08);
  box-shadow:
    0 8px 25px rgba(255, 215, 0, 0.7),
    0 0 20px rgba(255, 215, 0, 0.5);
}

.character-image-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid rgba(77, 212, 255, 0.7);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.21, 1);
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.25),
    rgba(66, 159, 216, 0.35)
  );
  box-shadow:
    0 0 35px rgba(77, 212, 255, 0.5),
    inset 0 0 25px rgba(77, 212, 255, 0.15);
  z-index: 2;
}

.character-image-wrapper::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(77, 212, 255, 0.3),
    transparent
  );
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.character-card:hover .character-image-wrapper::before {
  opacity: 1;
}

.character-card.character-themed .character-image-wrapper {
  border: 3px solid rgba(var(--character-primary-rgb), 0.8);
  background: linear-gradient(
    135deg,
    rgba(var(--character-primary-rgb), 0.3),
    rgba(var(--character-secondary-rgb), 0.2)
  );
  box-shadow: 0 0 30px rgba(var(--character-primary-rgb), 0.5);
}

.character-card:hover .character-image-wrapper {
  border-color: var(--primary-blue);
  box-shadow:
    0 0 40px var(--glow-blue),
    0 0 50px rgba(77, 212, 255, 0.3),
    inset 0 0 25px rgba(77, 212, 255, 0.2);
  transform: scale(1.08);
}

.character-card.character-themed:hover .character-image-wrapper {
  border-color: var(--character-primary);
  box-shadow:
    0 0 50px rgba(var(--character-primary-rgb), 0.8),
    inset 0 0 30px rgba(var(--character-primary-rgb), 0.2);
}

.character-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.21, 1);
  filter: brightness(0.9) contrast(1.1);
  border-radius: 50%;
}

.character-card:hover .character-card-image {
  transform: scale(1.1);
  filter: brightness(1.1) contrast(1.2) saturate(1.05);
}

/* ========== CHARACTER INFO SECTION ========== */
.character-portrait {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: 3.5rem;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(77, 212, 255, 0.3),
    transparent
  );
  transition: all 0.3s ease;
}

.character-card:hover .character-portrait {
  transform: scale(1.1);
}

.character-info {
  text-align: center;
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.character-name {
  font-family: "Cinzel", serif;
  font-size: 1.3rem;
  font-weight: bold;
  color: #ffffff;
  margin: 0;
  text-shadow:
    0 0 15px rgba(77, 212, 255, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.9);
  transition: all 0.3s ease;
  line-height: 1.2;
}

.character-card:hover .character-name {
  color: #ffffff;
  text-shadow:
    0 0 15px rgba(77, 212, 255, 0.8),
    0 0 25px rgba(77, 212, 255, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.9);
  transform: translateY(-2px) scale(1.03);
}

.character-card.character-themed:hover .character-name {
  color: #ffffff;
  text-shadow:
    0 0 15px rgba(var(--character-primary-rgb), 0.8),
    0 2px 4px rgba(0, 0, 0, 0.8);
}

.character-title {
  color: rgba(77, 212, 255, 0.9);
  font-size: 0.8rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
  opacity: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.character-card.character-themed .character-title {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.character-card:hover .character-title {
  transform: translateY(-2px);
  text-shadow:
    0 0 10px rgba(77, 212, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.8);
  opacity: 1;
}

.character-card.character-themed:hover .character-title {
  text-shadow:
    0 0 10px rgba(var(--character-primary-rgb), 0.6),
    0 1px 2px rgba(0, 0, 0, 0.8);
}

.character-race-role {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.character-race,
.character-role {
  background: rgba(21, 25, 35, 0.9);
  border: 1px solid rgba(77, 212, 255, 0.7);
  color: rgba(255, 255, 255, 0.98);
  padding: 0.3rem 0.6rem;
  border-radius: 14px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  flex: 1;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  min-width: 0;
  word-wrap: break-word;
  hyphens: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.character-card.character-themed .character-race,
.character-card.character-themed .character-role {
  background: rgba(21, 25, 35, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.character-card:hover .character-race,
.character-card:hover .character-role {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 5px 15px rgba(77, 212, 255, 0.35),
    0 0 12px rgba(77, 212, 255, 0.18);
  border-color: rgba(77, 212, 255, 0.85);
}

.character-card.character-themed:hover .character-race,
.character-card.character-themed:hover .character-role {
  box-shadow: 0 4px 12px rgba(var(--character-primary-rgb), 0.3);
}

.character-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(77, 212, 255, 0.4);
  border-radius: 15px;
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.9),
    rgba(35, 53, 80, 0.7)
  );
  position: relative;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.character-stats::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(77, 212, 255, 0.05), transparent);
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.character-card:hover .character-stats::before {
  opacity: 1;
}

.character-card.character-themed .character-stats {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.9),
    rgba(35, 53, 80, 0.7)
  );
}

.stat-item {
  text-align: center;
  position: relative;
  padding: 0.5rem;
  transition: transform 0.3s ease;
  border-radius: 10px;
  background: rgba(21, 25, 35, 0.7);
  border: 1px solid rgba(77, 212, 255, 0.3);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.character-card:hover .stat-item {
  transform: translateY(-3px) scale(1.03);
  background: rgba(21, 25, 35, 0.9);
  border-color: rgba(77, 212, 255, 0.5);
  box-shadow: 0 4px 12px rgba(77, 212, 255, 0.25);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: bold;
  color: #ffffff;
  margin-bottom: 0.2rem;
  text-shadow:
    0 0 10px rgba(77, 212, 255, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.8);
  transition: all 0.3s ease;
  font-family: "Rajdhani", sans-serif;
}

.character-card:hover .stat-value {
  color: rgba(77, 212, 255, 0.95);
  text-shadow:
    0 0 15px rgba(77, 212, 255, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.8);
}

.character-card.character-themed:hover .stat-value {
  color: #ffffff;
  text-shadow:
    0 0 15px rgba(var(--character-primary-rgb), 0.8),
    0 2px 4px rgba(0, 0, 0, 0.8);
}

.stat-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.character-bonuses {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
  justify-content: center;
}

.bonus-tag {
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  );
  border: 1px solid rgba(77, 212, 255, 0.7);
  color: rgba(255, 255, 255, 0.98);
  padding: 0.4rem 0.8rem;
  border-radius: 18px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bonus-tag::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 212, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.character-card:hover .bonus-tag::before {
  left: 100%;
}

.character-card:hover .bonus-tag {
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 5px 18px rgba(77, 212, 255, 0.35),
    0 0 12px rgba(77, 212, 255, 0.2);
  border-color: rgba(77, 212, 255, 0.85);
}

.character-card.character-themed .bonus-tag {
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.9),
    rgba(35, 53, 80, 0.8)
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.character-card.character-themed:hover .bonus-tag {
  box-shadow: 0 5px 15px rgba(var(--character-primary-rgb), 0.3);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ========== CHARACTER ACTIONS ========== */
.character-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
  margin-top: auto;
}

.recruit-button {
  width: 100%;
  padding: 0.8rem;
  font-size: 0.9rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.21, 1);
  background: linear-gradient(135deg, var(--primary-blue), #2a9fd8);
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: "Rajdhani", sans-serif;
}

.recruit-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.recruit-button:hover::before {
  left: 100%;
}

.recruit-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px var(--glow-blue);
}

.recruit-button:active {
  transform: translateY(-1px) scale(0.98);
}

.recruit-button:disabled {
  background: rgba(77, 212, 255, 0.3);
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.view-profile-button {
  width: 100%;
  padding: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid rgba(77, 212, 255, 0.7);
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  );
  color: rgba(255, 255, 255, 0.98);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.21, 1);
  font-family: "Rajdhani", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.view-profile-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 212, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.view-profile-button:hover::before {
  left: 100%;
}

.character-card.character-themed .view-profile-button {
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.95);
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.9),
    rgba(35, 53, 80, 0.8)
  );
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.view-profile-button:hover {
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.2),
    rgba(66, 159, 216, 0.15)
  );
  border-color: rgba(77, 212, 255, 0.9);
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 8px 25px rgba(77, 212, 255, 0.35),
    0 0 20px rgba(77, 212, 255, 0.25);
  color: #ffffff;
}

.character-card.character-themed .view-profile-button:hover {
  background: linear-gradient(
    135deg,
    rgba(var(--character-primary-rgb), 0.15),
    rgba(var(--character-secondary-rgb), 0.1)
  );
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 25px rgba(var(--character-primary-rgb), 0.3);
}

.view-profile-button:active {
  transform: translateY(-1px) scale(0.98);
}

.view-details-button {
  width: 100%;
  padding: 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(77, 212, 255, 0.4);
  border-radius: 8px;
  background: rgba(21, 25, 35, 0.8);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.21, 1);
  font-family: "Rajdhani", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(5px);
}

.view-details-button:hover {
  background: rgba(77, 212, 255, 0.1);
  border-color: rgba(77, 212, 255, 0.6);
  color: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(77, 212, 255, 0.2);
}

.view-details-button:active {
  transform: translateY(-1px) scale(0.98);
}

/* ========== PAGINATION CONTROLS ========== */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 3rem auto 2rem auto;
  padding: 1.5rem;
  background: linear-gradient(
    145deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  );
  backdrop-filter: blur(20px);
  border: 2px solid rgba(77, 212, 255, 0.4);
  border-radius: 24px;
  max-width: 600px;
  width: fit-content;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(77, 212, 255, 0.2);
}

.pagination-btn {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.2),
    rgba(66, 159, 216, 0.1)
  );
  border: 2px solid rgba(77, 212, 255, 0.6);
  border-radius: 15px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Rajdhani", sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 120px;
  position: relative;
  overflow: hidden;
}

.pagination-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(77, 212, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.pagination-btn:hover::before {
  left: 100%;
}

.pagination-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(77, 212, 255, 0.3),
    rgba(66, 159, 216, 0.22)
  );
  border-color: var(--primary-blue);
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 6px 25px rgba(77, 212, 255, 0.4),
    0 0 18px rgba(77, 212, 255, 0.28);
  color: #ffffff;
}

.pagination-btn:disabled {
  background: rgba(77, 212, 255, 0.1);
  border-color: rgba(77, 212, 255, 0.2);
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pagination-btn:disabled::before {
  display: none;
}

.page-info {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-weight: 600;
  font-family: "Rajdhani", sans-serif;
  text-align: center;
  padding: 0 1rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  min-width: 200px;
}

.page-info .current-page {
  color: var(--primary-blue);
  font-weight: bold;
  text-shadow: 0 0 10px var(--glow-blue);
}

/* ========== CHARACTER THEMING ========== */
.character-card[data-character-id="rimuru"] {
  --character-primary: #4dd4ff;
  --character-secondary: #2a9fd8;
  --character-primary-rgb: 77, 212, 255;
  --character-secondary-rgb: 42, 159, 216;
}

.character-card[data-character-id="milim"] {
  --character-primary: #ff69b4;
  --character-secondary: #ff1493;
  --character-primary-rgb: 255, 105, 180;
  --character-secondary-rgb: 255, 20, 147;
}

.character-card[data-character-id="veldora"] {
  --character-primary: #ffd700;
  --character-secondary: #ffb347;
  --character-primary-rgb: 255, 215, 0;
  --character-secondary-rgb: 255, 179, 71;
}

.character-card[data-character-id="guy"] {
  --character-primary: #87ceeb;
  --character-secondary: #4682b4;
  --character-primary-rgb: 135, 206, 235;
  --character-secondary-rgb: 70, 130, 180;
}

.character-card[data-character-id="shion"] {
  --character-primary: #ff6347;
  --character-secondary: #dc143c;
  --character-primary-rgb: 255, 99, 71;
  --character-secondary-rgb: 220, 20, 60;
}

.character-card[data-character-id="benimaru"] {
  --character-primary: #ff4500;
  --character-secondary: #b22222;
  --character-primary-rgb: 255, 69, 0;
  --character-secondary-rgb: 178, 34, 34;
}

.character-card[data-character-id="shuna"] {
  --character-primary: #dda0dd;
  --character-secondary: #9370db;
  --character-primary-rgb: 221, 160, 221;
  --character-secondary-rgb: 147, 112, 219;
}

/* ========== LOADING AND ERROR STATES ========== */
.character-grid.loading {
  opacity: 0.5;
  pointer-events: none;
}

.character-grid.loading::after {
  content: "Loading characters...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--primary-blue);
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: rgba(232, 240, 255, 0.6);
  font-size: 1.1rem;
}

.no-results::before {
  content: "🔍";
  display: block;
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ========== ACCESSIBILITY AND FOCUS STATES ========== */
.character-card,
.filter-tab,
.view-profile-button,
.view-details-button {
  will-change: transform, box-shadow;
}

.filter-tab:focus,
.search-input:focus,
.recruit-button:focus,
.view-profile-button:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.character-card:hover .character-actions {
  transform: translateY(-2px);
}

.character-actions {
  transition: transform 0.3s ease;
}

/* ========== SPECIAL CHARACTER OVERRIDES ========== */
.character-card[data-character-id="geld"] .character-name,
.character-card[data-character-id="geld"] .character-title,
.character-card[data-character-id="geld"] .stat-value,
.character-card[data-character-id="geld"] .stat-label {
  color: #ffffff !important;
  text-shadow:
    0 0 12px rgba(0, 0, 0, 0.9),
    0 2px 4px rgba(0, 0, 0, 0.8) !important;
}

.character-card[data-character-id="geld"] .character-race,
.character-card[data-character-id="geld"] .character-role,
.character-card[data-character-id="geld"] .bonus-tag {
  background: rgba(21, 25, 35, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
}

.character-card[data-character-id="geld"] .view-profile-button {
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  ) !important;
  border: 2px solid rgba(255, 255, 255, 0.6) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
}

.character-card[data-character-id="geld"] .view-profile-button:hover {
  background: rgba(21, 25, 35, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

.character-card[data-character-id="geld"] .stat-item {
  background: rgba(21, 25, 35, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.character-card[data-character-id="guy"] .character-name,
.character-card[data-character-id="guy"] .character-title,
.character-card[data-character-id="guy"] .stat-value,
.character-card[data-character-id="guy"] .stat-label {
  color: #ffffff !important;
  text-shadow:
    0 0 12px rgba(0, 0, 0, 0.9),
    0 2px 4px rgba(0, 0, 0, 0.8) !important;
}

.character-card[data-character-id="guy"] .character-race,
.character-card[data-character-id="guy"] .character-role,
.character-card[data-character-id="guy"] .bonus-tag {
  background: rgba(21, 25, 35, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
}

.character-card[data-character-id="guy"] .view-profile-button {
  background: linear-gradient(
    135deg,
    rgba(21, 25, 35, 0.95),
    rgba(35, 53, 80, 0.9)
  ) !important;
  border: 2px solid rgba(255, 255, 255, 0.6) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
}

.character-card[data-character-id="guy"] .view-profile-button:hover {
  background: rgba(21, 25, 35, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

.character-card[data-character-id="guy"] .stat-item {
  background: rgba(21, 25, 35, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.character-card[data-character-id="geld"],
.character-card[data-character-id="guy"] {
  background: linear-gradient(
    145deg,
    rgba(var(--character-primary-rgb), 0.03),
    rgba(var(--character-secondary-rgb), 0.02)
  ) !important;
}

.character-card[data-character-id="geld"]::before,
.character-card[data-character-id="guy"]::before {
  background: radial-gradient(
    circle at 30% 30%,
    rgba(var(--character-primary-rgb), 0.04),
    transparent 70%
  ) !important;
}

.character-card[data-character-id="geld"]:hover .character-name,
.character-card[data-character-id="guy"]:hover .character-name {
  color: #ffffff !important;
  text-shadow:
    0 0 15px rgba(255, 255, 255, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.9) !important;
}

.character-card[data-character-id="geld"]:hover .character-title,
.character-card[data-character-id="guy"]:hover .character-title {
  color: rgba(255, 255, 255, 0.95) !important;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.9) !important;
}

.character-card[data-character-id="geld"]:hover .stat-value,
.character-card[data-character-id="guy"]:hover .stat-value {
  color: #ffffff !important;
  text-shadow:
    0 0 15px rgba(255, 255, 255, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.9) !important;
}

/* ========== RESPONSIVE TEXT SIZING ========== */
.character-role {
  font-size: 0.65rem;
  line-height: 1.1;
  word-break: break-word;
  hyphens: auto;
}

.character-card .character-role {
  font-size: clamp(0.55rem, 2vw, 0.7rem);
}

.character-status-badge {
  font-size: clamp(0.5rem, 1.5vw, 0.6rem);
}

.character-power-indicator {
  font-size: clamp(0.5rem, 1.5vw, 0.6rem);
}

.character-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  position: relative;
  min-height: 200px;
}

.character-header .character-power-indicator {
  position: absolute;
  left: 0.8rem;
  top: 0.8rem;
  z-index: 3;
}

.character-header .character-status-badge {
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
  max-width: calc(100% - 120px);
  z-index: 3;
}

/* ========== LOADING AND NO RESULTS STATES ========== */
.loading-characters {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--primary-blue);
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  position: relative;
}

.loading-characters::before {
  content: "";
  position: absolute;
  width: 60px;
  height: 60px;
  border: 4px solid rgba(77, 212, 255, 0.2);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: loadingSpin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes loadingSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-characters .loading-text {
  margin-top: 4rem;
  font-size: 1.2rem;
  text-shadow: 0 0 10px var(--glow-blue);
  animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  text-align: center;
  font-family: "Rajdhani", sans-serif;
  background: linear-gradient(
    145deg,
    rgba(21, 25, 35, 0.8),
    rgba(35, 53, 80, 0.6)
  );
  border: 2px solid rgba(77, 212, 255, 0.2);
  border-radius: 20px;
  margin: 2rem;
  position: relative;
  overflow: hidden;
}

.no-results::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(77, 212, 255, 0.05),
    transparent 70%
  );
  animation: noResultsGlow 3s ease-in-out infinite;
}

@keyframes noResultsGlow {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.7;
  }
}

.no-results .no-results-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.6;
  animation: noResultsBounce 2s ease-in-out infinite;
}

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

.no-results h3 {
  font-family: "Cinzel", serif;
  margin: 1rem 0;
  font-size: 1.8rem;
  color: var(--primary-blue);
  text-shadow: 0 0 15px var(--glow-blue);
  position: relative;
  z-index: 1;
}

.no-results p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.no-results button {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.21, 1);
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1rem 2rem;
  font-size: 1rem;
  border-radius: 12px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.no-results button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.no-results button:hover::before {
  left: 100%;
}

.no-results button:hover {
  background: #2a9fd8 !important;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(77, 212, 255, 0.5);
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */
.stat-card,
.filter-select,
.search-input,
.character-card,
.character-stats,
.stat-item,
.bonus-tag,
.view-profile-button,
.pagination-controls,
.modal-content {
  backdrop-filter: none !important;
}

.character-card:hover .character-actions {
  transform: translateY(-2px);
}

/* ========== MOBILE RESPONSIVE STYLES ========== */
@media (max-width: 767px) {
  .codex-container {
    padding: 1.5rem 1rem;
    padding-top: 2rem; /* Reduced since navbar is no longer fixed */
  }

  /* Character Grid */
  .character-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  /* Page Header */
  .page-title {
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
  }

  .page-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  /* Statistics Cards */
  .codex-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 0 0.5rem;
  }

  .stat-card {
    padding: 1rem;
    min-height: 100px;
  }

  .stat-number {
    font-size: 2rem;
  }

  .stat-label {
    font-size: 0.8rem;
  }

  /* Search and Filters */
  .search-input {
    max-width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
  }

  .filter-section {
    gap: 1rem;
  }

  .filter-tabs {
    gap: 0.3rem;
    justify-content: center;
  }

  .filter-tab {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    border-radius: 20px;
  }

  .advanced-filters {
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
  }

  .filter-select {
    width: 100%;
    max-width: 280px;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
  }

  .clear-filters-btn {
    width: 100%;
    max-width: 280px;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
  }

  /* Character Grid */
  .character-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 0 0.5rem;
  }

  .character-card {
    max-width: 100%;
    min-height: 420px;
  }

  .character-header {
    height: 160px;
    padding: 0.8rem;
  }

  .character-image-wrapper {
    width: 90px;
    height: 90px;
  }

  .character-status-badge,
  .character-power-indicator {
    padding: 0.2rem 0.4rem;
    font-size: 0.5rem;
    border-radius: 8px;
    max-width: 80px;
  }

  .character-info {
    padding: 1rem;
    gap: 0.8rem;
  }

  .character-name {
    font-size: 1.1rem;
  }

  .character-race-role {
    gap: 0.3rem;
  }

  .character-race,
  .character-role {
    padding: 0.25rem 0.5rem;
    font-size: 0.6rem;
    border-radius: 8px;
  }

  .character-stats {
    gap: 0.5rem;
    padding: 0.8rem;
    margin: 0.8rem 0;
  }

  .stat-item {
    padding: 0.4rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stat-label {
    font-size: 0.6rem;
  }

  .character-bonuses {
    gap: 0.3rem;
    margin: 0.5rem 0;
  }

  .bonus-tag {
    padding: 0.3rem 0.6rem;
    font-size: 0.6rem;
    border-radius: 10px;
  }

  .character-actions {
    padding: 0 1rem 1rem;
    gap: 0.4rem;
  }

  /* Pagination */
  .pagination-controls {
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
    margin: 2rem auto 1rem auto;
  }

  .pagination-btn {
    width: 100%;
    max-width: 200px;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  .page-info {
    font-size: 0.9rem;
    padding: 0;
  }

  /* Modal Adjustments */
  .modal-content {
    margin: 0.5rem;
    max-height: 95vh;
    border-radius: 16px;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .modal-character-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .modal-character-image {
    width: 100px;
    height: 100px;
  }

  .modal-character-info h2 {
    font-size: 1.6rem;
  }

  .modal-stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .modal-actions {
    flex-direction: column;
    gap: 0.8rem;
  }

  .modal-action-btn {
    width: 100%;
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    min-height: 44px;
  }

  /* Lore Section */
  .section-title {
    font-size: 2rem;
  }

  .lore-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .lore-card {
    padding: 1.5rem;
  }

  .lore-card h3 {
    font-size: 1.2rem;
  }

  .lore-card p {
    font-size: 0.9rem;
  }

  .view-profile-button,
  .view-details-button {
    padding: 0.7rem;
    font-size: 0.8rem;
    border-radius: 8px;
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Remove special 11-card layout on mobile */
  .character-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .character-card {
    max-width: none;
    min-height: 420px;
  }

  /* ===== MOBILE PERFORMANCE & UX OPTIMIZATIONS ===== */
  /* Disable heavy background effects */
  .magic-circle,
  .particles,
  .starfield {
    display: none !important;
  }

  /* Reduce hover effects on touch devices */
  .character-card:hover {
    transform: none;
  }

  /* Enable touch scrolling */
  body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* Optimize touch interactions */
  .character-card,
  .filter-tab,
  .view-profile-button,
  .view-details-button,
  .pagination-btn {
    -webkit-tap-highlight-color: rgba(77, 212, 255, 0.2);
    touch-action: manipulation;
  }

  /* Improve text readability on mobile */
  .character-name,
  .character-title,
  .stat-label,
  .bonus-tag {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  /* Ensure minimum touch target sizes */
  .character-card,
  .filter-tab,
  button,
  .view-profile-button,
  .view-details-button {
    min-height: 44px;
  }

  /* Optimize animations for mobile */
  .character-card,
  .filter-tab,
  .stat-card {
    will-change: auto;
    transform: translateZ(0);
  }

  /* Reduce motion for better performance */
  * {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
  }

  /* Mobile-specific focus styles */
  .search-input:focus,
  .filter-select:focus,
  .filter-tab:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
  }

  /* Improve mobile navigation visibility */
  .mobile-menu-toggle {
    z-index: 1001;
  }

  .mobile-nav {
    z-index: 1000;
  }

  /* Better mobile modal handling */
  .character-modal {
    padding: 0.5rem;
  }

  .character-modal .modal-content {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 12px;
  }

  /* Improve search suggestions on mobile */
  .search-suggestions {
    max-height: 150px;
    border-radius: 0 0 12px 12px;
  }

  .search-suggestion {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

/* ========== SMALL PHONE STYLES ========== */
@media (max-width: 479px) {
  .codex-container {
    padding: 1rem 0.5rem;
    padding-top: 1.5rem;
  }

  .page-title {
    font-size: 1.8rem;
  }

  .page-subtitle {
    font-size: 0.95rem;
  }

  /* Single column layout for very small screens */
  .character-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
    padding: 0 0.25rem;
  }

  .character-card {
    max-width: 100%;
    min-height: 380px;
  }

  .character-header {
    height: 140px;
  }

  .character-image-wrapper {
    width: 80px;
    height: 80px;
  }

  .character-name {
    font-size: 1rem;
  }

  .character-info {
    padding: 0.8rem;
  }

  .character-stats {
    padding: 0.6rem;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  .codex-stats {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .filter-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }

  .filter-tab {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
  }

  /* Remove eleven cards special handling */
  .character-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== TABLET STYLES ========== */
@media (min-width: 768px) {
  .main-content.codex-page {
    padding: 2rem;
    padding-top: 2rem;
  }

  .page-title {
    font-size: 2.8rem;
  }

  .codex-grid,
  .codex-categories,
  .codex-entries {
    grid-template-columns: repeat(2, 1fr);
  }

  .codex-card button,
  .entry-card button {
    width: auto;
  }
}

/* ========== LAPTOP STYLES ========== */
@media (min-width: 1024px) {
  .main-content.codex-page {
    max-width: 1400px;
  }

  .codex-grid,
  .codex-categories,
  .codex-entries {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========== LARGE SCREEN STYLES ========== */
@media (min-width: 1280px) {
  .main-content.codex-page {
    max-width: 1600px;
  }
}

/* ========== REDUCED MOTION ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  .codex-card,
  .entry-card {
    animation: none;
    transition: none;
  }
}
