html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #7c3aed;
  border-color: #7c3aed !important;
}

/* Form styles for Identity pages */
.form-floating > .form-control:focus ~ label {
  color: #7c3aed !important;
}

.form-floating > .form-control {
  transition: border-color 0.3s ease;
}

.form-floating > .form-control:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 0.25rem rgba(124, 58, 237, 0.1) !important;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #1f2937;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation hover states */
.navbar .nav-link:hover {
  background: rgba(147, 51, 234, 0.1) !important;
  color: #6366f1 !important;
}

/* Dropdown menu styles */
.dropdown-menu {
  border: 1px solid rgba(124, 58, 237, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 0.5rem;
}

.dropdown-item {
  color: #7c3aed;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
}

.dropdown-item:hover {
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
}

.dropdown-divider {
  margin: 0.5rem 0;
  border-color: rgba(124, 58, 237, 0.1);
}

/* Footer link styles */
footer a {
  transition: color 0.2s;
}

footer a:hover {
  color: #7c3aed !important;
}

/* Rounded buttons throughout */
.btn {
  border-radius: 25px !important;
  padding: 10px 24px !important;
  font-weight: 500 !important;
  transition: all 0.3s ease !important;
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%) !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3) !important;
}

.btn-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4) !important;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #7c3aed !important;
  border: 2px solid #7c3aed !important;
}

.btn-secondary:hover {
  background: #7c3aed !important;
  color: white !important;
  transform: translateY(-2px) !important;
}

/* WordFlies Main Site Styles */
.game-lobby {
  padding: 40px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  min-height: calc(100vh - 200px);
  color: white;
  position: relative;
  overflow: hidden;
}

/* Ensure container has proper width */
.game-lobby .container {
  max-width: 1200px;
  width: 100%;
  padding: 0 15px;
  margin: 0 auto;
}

.game-lobby::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><radialGradient id="star" cx="50%" cy="50%" r="50%"><stop offset="0%" style="stop-color:white;stop-opacity:0.8" /><stop offset="100%" style="stop-color:white;stop-opacity:0" /></radialGradient></defs><circle cx="20" cy="20" r="1" fill="url(%23star)" /><circle cx="80" cy="40" r="0.5" fill="url(%23star)" /><circle cx="40" cy="70" r="1.5" fill="url(%23star)" /><circle cx="90" cy="80" r="1" fill="url(%23star)" /><circle cx="10" cy="90" r="0.8" fill="url(%23star)" /></svg>');
  background-size: 200px 200px;
  animation: starField 20s linear infinite;
  opacity: 0.3;
}

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

@keyframes starField {
  0% { transform: translateY(0); }
  100% { transform: translateY(-200px); }
}

.welcome-panel {
  background: rgba(248, 245, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(147, 51, 234, 0.15);
  box-shadow: 0 20px 40px rgba(147, 51, 234, 0.1);
  animation: floatIn 1s ease-out;
  color: #1f2937;
}

@keyframes floatIn {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-title {
  font-size: 3.5rem;
  font-weight: bold;
  margin-bottom: 10px;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  background: linear-gradient(45deg, #FFD700, #FFA500, #FF6B35, #FFD700);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease-in-out infinite, titlePulse 2s ease-in-out infinite;
}

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

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

.game-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 30px;
}

.game-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.mode-card {
  background: rgba(248, 245, 255, 0.95);
  padding: 30px 20px;
  border-radius: 15px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid rgba(147, 51, 234, 0.1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  color: #1f2937;
}

.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.mode-card:hover {
  transform: translateY(-10px) scale(1.02);
  background: rgba(255, 255, 255, 1);
  border-color: rgba(147, 51, 234, 0.3);
  box-shadow: 0 20px 40px rgba(147, 51, 234, 0.15);
}

.mode-card:hover::before {
  left: 100%;
}

.mode-card:active {
  transform: translateY(-5px) scale(0.98);
}

.mode-card h3 {
  margin-bottom: 15px;
  font-size: 1.5rem;
  color: #7c3aed;
  font-weight: 700;
}

.mode-card p {
  margin-bottom: 20px;
  color: #6b7280;
}

.shape-selector {
  margin-top: 30px;
}

.shape-options {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.shape-btn {
  width: 60px;
  height: 60px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shape-btn:hover, .shape-btn.active {
  background: rgba(255, 255, 255, 0.3);
  border-color: #FFD700;
  transform: scale(1.1);
}

.player-stats, .power-ups {
  background: rgba(248, 245, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 25px;
  border-radius: 15px;
  margin-bottom: 20px;
  border: 1px solid rgba(147, 51, 234, 0.15);
  color: #1f2937;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  opacity: 0.8;
}

.stat-value {
  font-weight: bold;
  color: #7c3aed;
}

.powerup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.powerup-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  transition: all 0.3s ease;
}

.powerup-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.powerup-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 5px;
}

.powerup-name {
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.powerup-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  display: inline-block;
}

.recent-achievements {
  margin-top: 20px;
}

.achievement-list {
  max-height: 150px;
  overflow-y: auto;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.achievement-icon {
  font-size: 1.2rem;
}

.achievement-name {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Profile Styles */
.profile-container {
  padding: 30px 0;
}

.profile-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
}

.profile-name {
  font-size: 2rem;
  margin-bottom: 10px;
}

.profile-level {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 20px;
}

.profile-stats {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
  border-bottom: none;
}

.profile-progress {
  text-align: center;
}

.profile-content {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.achievement-card {
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
}

.achievement-card.unlocked {
  border-color: #4CAF50;
  background: linear-gradient(135deg, #E8F5E8 0%, #F1F8E9 100%);
}

.achievement-card.locked {
  opacity: 0.6;
  background: #f9f9f9;
}

.achievement-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.achievement-icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 10px;
}

.achievement-name {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.achievement-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 10px;
}

.achievement-rarity {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
}

.achievement-rarity.common {
  background: #9E9E9E;
  color: white;
}

.achievement-rarity.rare {
  background: #2196F3;
  color: white;
}

.achievement-rarity.epic {
  background: #9C27B0;
  color: white;
}

.achievement-rarity.legendary {
  background: #FF9800;
  color: white;
}

/* Leaderboard Styles */
.leaderboard-container {
  padding: 30px 0;
}

.leaderboard-header {
  text-align: center;
  margin-bottom: 30px;
}

.leaderboard-header h1 {
  font-size: 3rem;
  background: linear-gradient(45deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.leaderboard-filters {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-weight: 500;
  color: #666;
}

.leaderboard-table {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 80px 1fr 200px 120px;
  gap: 20px;
  align-items: center;
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 10px;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.leaderboard-item:hover {
  background: #f8f9fa;
  transform: translateX(5px);
}

.leaderboard-item.current-user {
  background: linear-gradient(135deg, #E3F2FD 0%, #E8F5E8 100%);
  border-color: #2196F3;
}

.leaderboard-item.top-1 {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFFDE7 100%);
  border-color: #FFD700;
}

.leaderboard-item.top-2 {
  background: linear-gradient(135deg, #F3E5F5 0%, #FCE4EC 100%);
  border-color: #C0C0C0;
}

.leaderboard-item.top-3 {
  background: linear-gradient(135deg, #FFF3E0 0%, #FBE9A7 100%);
  border-color: #CD7F32;
}

.rank {
  text-align: center;
}

.medal {
  font-size: 2rem;
}

.rank-number {
  font-size: 1.5rem;
  font-weight: bold;
  color: #666;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.player-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
}

.player-name {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 5px;
}

.player-level {
  font-size: 0.9rem;
  color: #666;
}

.you-badge {
  background: #2196F3;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  margin-left: 8px;
}

.player-stats {
  text-align: center;
}

.primary-stat {
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
}

.stat-label {
  font-size: 0.8rem;
  color: #666;
  display: block;
}

.secondary-stats {
  font-size: 0.8rem;
  color: #666;
}

.stat-item {
  margin-right: 10px;
}

.player-achievements {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.achievement-badge {
  font-size: 1.2rem;
  opacity: 0.8;
}

.leaderboard-sidebar {
  padding-left: 20px;
}

.daily-challenge, .recent-achievements, .global-stats {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.challenge-info {
  margin-top: 15px;
}

.challenge-stats {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
}

.challenge-completed {
  background: #E8F5E8;
  color: #2E7D32;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
}

.achievement-feed {
  max-height: 200px;
  overflow-y: auto;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.achievement-item:last-child {
  border-bottom: none;
}

.global-stat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.global-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

/* Challenge styles */
.challenge-info {
  margin-top: 10px;
  margin-bottom: 15px;
}

.challenge-info .badge {
  font-size: 0.9rem;
  padding: 6px 12px;
}

.bg-purple {
  background-color: #9C27B0;
  color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-modes {
    grid-template-columns: 1fr;
  }
  
  .shape-options {
    flex-wrap: wrap;
  }
  
  .leaderboard-filters {
    flex-direction: column;
  }
  
  .leaderboard-item {
    grid-template-columns: 60px 1fr;
    gap: 15px;
  }
  
  .player-stats, .player-achievements {
    grid-column: 1 / -1;
    margin-top: 10px;
  }
  
  .achievements-grid {
    grid-template-columns: 1fr;
  }
}

/* Achievement Card Styles */
.achievement-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.achievement-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.achievement-card.locked {
  opacity: 0.8;
}

.achievement-card .card-header {
  border-bottom: 2px solid rgba(0,0,0,0.1);
}

/* Rarity Colors */
.bg-purple {
  background-color: #9333ea !important;
  color: white;
}

/* Achievement Icons */
.achievement-card .h2 {
  font-size: 2.5rem;
}

/* Filter Button Active State */
.filter-tab.active {
  background-color: #0d6efd !important;
  color: white !important;
}

/* Header Styling - Ensure all headers are bold and readable */
h1, h2, h3, h4, h5, h6 {
  font-weight: bold !important;
}

/* Specific header containers for better readability */
.header-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(147, 51, 234, 0.1);
  border: 1px solid rgba(147, 51, 234, 0.1);
}

/* Gradient text for special headers */
.gradient-text {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: bold !important;
}

/* Fix dropdown z-index issues */
.navbar .dropdown-menu {
  z-index: 1050 !important;
  position: absolute !important;
}

.navbar .nav-item.dropdown {
  position: relative;
  z-index: 1051 !important;
}

.dropdown-menu {
  z-index: 1050 !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Override card positioning when it interferes with navbar dropdowns */
.navbar-wrapper {
  position: relative;
  z-index: 1000;
}

/* Ensure cards don't interfere with dropdown positioning */
.card {
  position: static !important;
}

/* Only apply relative positioning to cards that need it (not in header area) */
main .card {
  position: relative;
}