/* Center the games grid and its items */
.games-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px 24px; /* adjust as needed */
  margin: 0 auto 2em auto;
  padding: 0;
}
.game-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
/* Center text utility class */
.center-text {
  text-align: center;
}
/* Reset and base styles */
.ad-img-small {
  max-width: 180px;
  max-height: 90px;
  border-radius: 8px;
  box-shadow: 0 2px 8px #000a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.palestine {
  background-color: black;
  color: white;
}

body {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  background: linear-gradient(135deg, #e0f6ff 0%, #b3e5fc 100%);
  color: #333;
}

/* Container for consistent padding and max-width */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 20px;
  color: #2c3e50;
}

h1 {
  font-size: 2.5rem;
  text-align: center;
  margin-top: 30px;
}

h2 {
  font-size: 2rem;
  padding: 15px 0;
  border-bottom: 2px solid #e0e0e0;
}
h3 {
  font-size: 2rem;
  padding: 15px 0;
}

p {
  margin-bottom: 15px;
}

a {
  color: #87ceeb;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #5f9ea0;
  text-decoration: underline;
}

h6 {
  color: white;
}

/* Navigation */
.topnav {
  display: flex;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.topnav a {
  display: block;
  color: #333;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.topnav a:hover {
  background-color: rgba(135, 206, 235, 0.2);
  color: #333;
  text-decoration: none;
}

.topnav a.active {
  background-color: #87ceeb;
  color: #333;
}

/* Hero section */
.hero {
  background: linear-gradient(135deg, #d0e7ff 0%, #a0c4ff 100%);
  color: #333;
  padding: 60px 20px;
  text-align: center;
  margin-bottom: 30px;
  box-shadow: inset 0 0 100px rgba(255, 255, 255, 0.3);
}

.hero h1 {
  color: #333;
  font-size: 3rem;
  margin-bottom: 20px;
}

.hero p {
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto 30px;
}

.btn {
  display: inline-block;
  background-color: rgba(255, 107, 53, 0.4);
  color: #fff;
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: bold;
  transition: all 0.3s ease;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn:hover {
  background-color: rgba(255, 107, 53, 0.6);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

/* Games grid */
.games-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
}

.game-item {
  text-align: center;
  display: inline-block;
  margin: 10px;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 150px;
  position: relative;
  perspective: 1000px;
}

.game-item:hover,
.game-item:focus-within {
  transform: translateY(-8px);
  z-index: 5;
}

.game-item button {
  width: 100%;
  height: 100px;
  border: none;
  border-radius: 15px;
  background-color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.game-item button:hover,
.game-item button:focus {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transform: translateZ(10px) rotateX(5deg);
  background-color: #f8f9fa;
  outline: none;
}

.game-item button:focus {
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
  border: 2px solid rgba(52, 152, 219, 0.6);
}

.game-item button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.1s ease;
}

.game-item button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.game-item button:hover::after,
.game-item button:focus::after {
  opacity: 1;
  transform: scale(2);
}

.game-item img {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
  transition: transform 0.3s ease;
  z-index: 2;
  position: relative;
}

.game-item:hover img,
.game-item:focus-within img {
  transform: scale(1.1);
}

.game-item p {
  margin-top: 10px;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

/* --- RED HOVER FOR GAME BUTTON TEXT --- */
.game-item:hover p,
.game-item:focus-within p {
  color: #e74c3c;
  transform: scale(1.05);
}

.game-item:hover p::after,
.game-item:focus-within p::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: #e74c3c;
  bottom: -3px;
  left: 0;
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease;
  animation: underlineAnimation 0.3s forwards;
}

@keyframes underlineAnimation {
  to {
    transform: scaleX(1);
    transform-origin: bottom left;
  }
}

/* Marquee styling */
.marquee-container {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 10px;
  margin: 20px 0;
  border-radius: 10px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

marquee {
  padding: 5px 0;
}

marquee img {
  margin: 0 10px;
  vertical-align: middle;
}

/* Footer */
footer {
  background-color: #2c3e50;
  color: white;
  padding: 30px 0;
  margin-top: 50px;
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
}

.footer-links a {
  color: white;
  margin: 0 15px;
}

.copyright {
  margin-top: 20px;
  font-size: 0.9rem;
  color: #bdc3c7;
}

/* Credits page */
.credits-section {
  background-color: white;
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.credits-section h2 {
  color: #3498db;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 10px;
}

.credits-list {
  list-style-type: none;
}

.credits-list li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

/* Open Source page */
.license-section {
  background-color: white;
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.license-section h2 {
  color: #3498db;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 10px;
}

.license-section pre {
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin: 15px 0;
}

.cta-section {
  text-align: center;
  margin: 40px 0;
}

/* Responsive styles */
@media (max-width: 768px) {
  .topnav {
    flex-direction: column;
  }

  .topnav a {
    width: 100%;
    padding: 12px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .game-item {
    width: 130px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .hero {
    padding: 30px 15px;
  }

  .game-item {
    width: 110px;
  }

  .game-item button {
    height: 80px;
  }

  .game-item img {
    max-width: 60px;
    max-height: 60px;
  }

  .footer-links a {
    margin: 5px 10px;
  }
}
/* ...existing code... */

/* Dark Theme Support */
body.dark-theme,
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6,
body.dark-theme p,
body.dark-theme li,
body.dark-theme span,
body.dark-theme label,
body.dark-theme a,
body.dark-theme th,
body.dark-theme td,
body.dark-theme input,
body.dark-theme textarea,
body.dark-theme select {
  color: #fff !important;
}

/* Strong dark theme override for all backgrounds */
body.dark-theme,
body.dark-theme .container,
body.dark-theme .credits-section,
body.dark-theme .license-section,
body.dark-theme .archive-section,
body.dark-theme .footer-content,
body.dark-theme footer,
body.dark-theme .marquee-container,
body.dark-theme .topnav,
body.dark-theme .hero,
body.dark-theme .archive-item {
  background: #181a1b !important;
  color: #fff !important;
}

body.dark-theme .hero {
  background: linear-gradient(to right, #b51313, #2c3e50) !important;
  color: #fff !important;
}

#anime-mode-toggle {
  position: relative;
  margin-top: auto;
  padding: 10px 20px;
  background-color: #ff4081;
  color: white;
  margin-right: auto;
  margin-bottom: 20px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
}

#anime-mode-toggle:hover {
  background-color: #ff74a3;
}

.black-bg {
  background-color: black;
  color: white;
}

/* Overlay */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.popup-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Popup Container */
.popup-container {
  background: white;
  border-radius: 16px;
  padding: 40px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease;
  position: relative;
  text-align: center;
}

.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 35px;
  height: 35px;
  line-height: 1;
  transition: color 0.2s;
}

.popup-close:hover {
  color: #333;
}

.popup-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.popup-title {
  margin: 0 0 15px 0;
  font-size: 28px;
  color: #333;
  font-weight: 600;
}

.popup-message {
  margin: 0 0 30px 0;
  color: #666;
  font-size: 16px;
  line-height: 1.5;
}

.popup-button {
  display: inline-block;
  padding: 14px 32px;
  background: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.popup-button:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.popup-dismiss {
  display: block;
  margin-top: 15px;
  color: #999;
  font-size: 14px;
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
}

.popup-dismiss:hover {
  color: #666;
}

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

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