:root {
  /* Light Mode (default) */
  --primary-bg: linear-gradient(135deg, #f5f6fa 0%, #c3cfe2 100%);
  --secondary-bg: linear-gradient(to right, #fbff00, #15ff00);
  --card-bg: rgba(255, 255, 255, 0.6);
  --primary-accent: #ff0077;
  --secondary-accent: #fd458c;
  --text-color: #000000;
  --text-muted: #576471;
  --glow-color: rgba(250, 73, 102, 0.5);
  --border-color: #dee2e6;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --backdrop-blur: blur(10px);
}

body.dark-mode {
  /* Dark Mode */
  --primary-bg: linear-gradient(to top, #30cfd0 0%, #330867 100%);
  --secondary-bg: #0f0c29;
  --card-bg: rgba(0, 0, 0, 0.3);
  --primary-accent: #ff0077;
  --secondary-accent: #ff006a;
  --text-color: #f0f0f0;
  --text-muted: #b0b0b0;
  --glow-color: rgba(255, 88, 88, 0.4);
  --border-color: rgba(255, 255, 255, 0.1);
  --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --backdrop-blur: blur(15px);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--primary-bg);
    color: var(--text-color);
    line-height: 1.6;
    transition: background 0.5s ease, color 0.5s ease;
    width: 100%;
}

/* Header */
header {
    background: var(--secondary-bg);
    padding: 1rem 5%;
    border-bottom: 2px solid var(--secondary-accent);
    transition: background 0.5s ease, border-bottom-color 0.5s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 1rem;
}

.logo {
    width: 60px;
    height: 60px;
    margin-right: 1rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    transition: color 0.5s ease;
}

header p {
    color: var(--text-muted);
    transition: color 0.5s ease;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    /* background: linear-gradient(
    to right,
    #ff0000,
    #ff7f00,
    #ffff00,
    #00ff00,
    #0000ff,
    #4b0082,
    #8f00ff
  );
  padding: 10px 20px;
  border-radius: 10px; */

}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 1rem;
    padding: 0.5rem 0;
    font-weight: 600;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--primary-accent);
    transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-accent);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: 2px solid var(--secondary-accent);
    color: var(--secondary-accent);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.4s ease;
    margin-left: 1rem;
}

#theme-toggle:hover {
    background: var(--secondary-accent);
    color: var(--text-color);
    box-shadow: 0 0 10px var(--secondary-accent);
    transform: /*translateY(-2px)*/ scale(1.1);
}

#theme-toggle i {
    transition: transform 0.5s ease-in-out;
}

body.dark-mode #theme-toggle i {
    transform: rotate(360deg);
}

/* Search Bar */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

#search-bar {
    width: 250px;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border-radius: 20px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
}

#search-bar:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 15px var(--glow-color);
}

.search-icon {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    transition: color 0.5s ease;
}

/* Main Content & Game Grid */
main {
    padding: 2rem 5%;
    width: 100%;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.game-card {
    background: var(--card-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: var(--card-shadow);
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--card-shadow);
    border-color: var(--primary-accent);
}

.game-card-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.game-card-title {
    padding: 1rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
    transition: color 0.5s ease;
}

/* Ad Slots */
.ad-slot {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: var(--card-shadow);
    transition: all 0.5s ease;
}
.ad-slot-top {
    width: 100%;
    min-height: 300px;
}
.ad-slot-bottom {
    width: 100%;
    min-height: 300px;
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-controls button {
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--secondary-accent);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination-controls button:hover,
.pagination-controls button.active {
    background: var(--primary-accent);
    border-color: var(--primary-accent);
    color: #fff;
    box-shadow: 0 0 10px var(--primary-accent);
}

.pagination-controls button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    height: 90%;
    top: 50%;
    transform: translateY(-50%);
    max-width: 1200px;
    background: var(--secondary-bg);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.close-button {
    color: #fff;
    position: absolute;
    top: -10px;
    right: 5px;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 2001;
}

.close-button:hover,
.close-button:focus {
    color: var(--primary-accent);
    text-decoration: none;
}

.game-frame-container {
    flex-grow: 1;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

#game-frame {
    width: 100%;
    height: 100%;
    border: none;
}

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

/* Footer */
footer {
    background: var(--secondary-bg);
    padding: 2rem 5%;
    margin-top: 3rem;
    border-top: 2px solid var(--secondary-accent);
    transition: background 0.5s ease, border-top-color 0.5s ease;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.social-links a {
    color: var(--text-color);
    margin-left: 1rem;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-accent);
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    nav {
        flex-direction: column;
        align-items: center;
    }
    #theme-toggle {
        margin-top: 1rem;
    }
    #search-bar {
        width: 100%;
    }
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}