/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Fredoka", sans-serif;
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 16px;
}

/* Fix for deprecated h1 size behavior in sectioning content */
section h1,
article h1,
aside h1,
nav h1 {
  font-size: 2em;
  font-weight: bold;
  margin: 0.67em 0;
}

/* Specific fixes for our h1 elements */
.logo-text {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
}

.hero-title {
  font-size: 3rem !important;
  font-weight: 700 !important;
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem !important;
  }
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header Styles */
header {
  background: rgba(30, 41, 59, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  position: relative;
  width: 40px;
  height: 40px;
  background: linear-gradient(45deg, #9333ea, #ec4899);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(147, 51, 234, 0.4);
}

.logo-icon::before {
  content: "🧠";
  font-size: 1.25rem;
}

.ping-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #fde047;
  border-radius: 50%;
  animation: ping 1s infinite;
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.logo-text {
  font-size: 1.875rem;
  font-weight: 700;
  color: white;
}

.nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
  position: relative;
  padding: 0.5rem 0;
}

.nav a:hover {
  color: #fde047;
}

.nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #fde047;
  transition: width 0.3s ease;
}

.nav a:hover::after {
  width: 100%;
}

.nav-active {
  color: #fde047 !important;
}

.nav-active::after {
  width: 100%;
}

/* Authentication Styles */
.auth-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

#login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #9333ea, #ec4899);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

#login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(147, 51, 234, 0.4);
}

#login-btn:active {
  transform: translateY(0);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(147, 51, 234, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(147, 51, 234, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.user-email {
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
}

.user-role {
  color: #fde047;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.user-role.role-admin {
  color: #f87171;
}

.user-role.role-user {
  color: #60a5fa;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.btn-logout:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(239, 68, 68, 0.4);
}

.btn-logout:active {
  transform: translateY(0);
}

.btn-profile-action {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-profile-action:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(255, 255, 255, 0.2);
}

.btn-profile-action:active {
  transform: translateY(0);
}

/* Responsive Auth Styles */
@media (max-width: 768px) {
  .auth-container {
    gap: 0.5rem;
    margin-left: 0;
  }

  .user-profile {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    align-items: flex-start;
  }

  .user-info {
    width: 100%;
  }

  #login-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .btn-logout {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    width: 100%;
  }

  .nav {
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
  }
}

/* Hero Section */
.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  text-align: center;
  padding: 4rem 0;
}

.hero-content {
  animation: fadeInUp 1s ease-out;
  width: 100%;
}

.hero-mascot {
  margin-bottom: 2rem;
  animation: bounce 2s infinite;
}

.mascot-image {
  width: clamp(200px, 25vw, 300px);
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.hero-title {
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 700;
  color: white;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: clamp(1.5rem, 4vw, 1.5rem);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin-bottom: 3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.hero-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn-primary {
  background: linear-gradient(45deg, #9333ea, #ec4899);
  color: white;
  padding: 1rem 2rem;
  font-size: clamp(1rem, 3vw, 1.1rem);
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(147, 51, 234, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 1rem 2rem;
  font-size: clamp(1rem, 3vw, 1.1rem);
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Features Section */
.features {
  padding: 4rem 0;
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.feature-card {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-icon {
  font-size: clamp(2.5rem, 6vw, 3rem);
  margin-bottom: 1rem;
  display: block;
}

.feature-icon-img {
  width: clamp(80px, 15vw, 120px);
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon-img {
  transform: scale(1.1) translateY(-5px);
}

.feature-title {
  font-size: clamp(2rem, 4vw, 1.25rem);
  font-weight: 600;
  color: white;
  margin-bottom: 1rem;
}

.feature-description {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  font-size: clamp(1.2rem, 2.5vw, 1rem);
}

.section-title {
  font-size: clamp(2rem, 6vw, 2.5rem);
  font-weight: 700;
  color: white;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin-bottom: 1rem;
}

/* Game Modes Section */
.game-modes {
  padding: 4rem 0;
}

.game-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.game-mode-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.game-mode-card:hover {
  transform: translateY(-10px);
}

.game-mode-image {
  margin-top: 20px;
  width: 80%;
  height: 50%;
  object-fit: cover;
  display: block;
  object-position: center;
  justify-self: center;
}

.game-mode-content {
  padding: 1.5rem;
}

/* Centralized Game Mode Action Button */
.game-modes-action {
  text-align: center;
  margin-top: 3rem;
}

.btn-large {
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  padding: 1.25rem 2.5rem;
  border-radius: 50px;
  min-width: 280px;
}

.game-mode-title {
  font-size: clamp(2rem, 3vw, 1.25rem);
  justify-self: center;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.game-mode-description {
  color: #64748b;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  font-size: clamp(1rem, 2.5vw, 1rem);
}

/* Footer */
footer {
  background: rgba(30, 41, 59, 0.95);
  color: white;
  padding: 3rem 0 1.5rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  font-weight: 600;
  margin-bottom: 1rem;
  color: #fde047;
}

.footer-section p,
.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  line-height: 1.6;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
}

.footer-section a:hover {
  color: #fde047;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  text-align: center;
}

.gradient-text {
  background: linear-gradient(45deg, #9333ea, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 0 0.75rem;
  }

  /* Header Mobile */
  header {
    padding: 0.75rem 0;
  }

  .header-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
  }

  .logo-container {
    justify-content: flex-start;
    flex-shrink: 0;
  }

  .logo-text {
    font-size: 1.25rem;
  }

  .nav {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .nav a {
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  /* Hero Mobile */
  .hero {
    min-height: 80vh;
    padding: 3rem 0;
  }

  .hero-subtitle {
    margin-bottom: 2rem;
    padding: 10px 1rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 280px;
    padding: 0.875rem 1.5rem;
  }

  /* Features Mobile */
  .features {
    padding: 3rem 0;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .feature-card {
    padding: 1.5rem;
    margin: 0 1rem;
  }

  /* Game Modes Mobile */
  .game-modes {
    padding: 3rem 0;
  }

  .game-modes-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .game-mode-card {
    margin: 0 1rem;
  }

  .game-mode-image {
    height: 50%;
    width: 70%;
    object-fit: cover;
    object-position: center;
  }

  .game-mode-content {
    padding: 1.25rem;
  }

  /* Footer Mobile */
  footer {
    padding: 2rem 0 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
  .container {
    padding: 0 0.5rem;
  }

  .hero {
    padding: 2rem 0;
  }

  .hero-title {
    margin-bottom: 1rem;
  }

  .hero-subtitle {
    margin-bottom: 1.5rem;
  }

  .features,
  .game-modes {
    padding: 2rem 0;
  }

  .feature-card,
  .game-mode-content {
    padding: 1rem;
  }

  .feature-card {
    margin: 0 2rem;
  }

  .game-mode-card {
    margin: 0 2rem;
  }

  .game-mode-image {
    height: 50%;
    width: 50%;
    object-fit: cover;
    object-position: center;
    justify-self: center;
  }

  .nav {
    gap: 1rem;
  }

  .nav a {
    font-size: 0.85rem;
  }
}

/* Tablet Landscape */
@media (min-width: 769px) and (max-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .game-modes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large Screens */
@media (min-width: 1200px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .game-modes-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-content {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .feature-card:hover,
  .game-mode-card:hover {
    transform: none;
  }

  .btn-primary:hover,
  .btn-secondary:hover {
    transform: none;
  }

  /* Increase touch targets */
  .nav a {
    padding: 0.75rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 44px;
    padding: 1rem 2rem;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-content {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .feature-card,
  .game-mode-card {
    border: 2px solid rgba(255, 255, 255, 0.8);
  }

  .nav a::after {
    height: 3px;
  }
}

/* Focus states for better accessibility */
.nav a:focus,
.btn-primary:focus,
.btn-secondary:focus,
.footer-section a:focus {
  outline: 2px solid #fde047;
  outline-offset: 2px;
}
