:root {
    --primary-color: #000000;
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --card-background: #2d2d2d;
    --card-hover: #3d3d3d;
}

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

body {
    font-family: 'Comic Sans MS', 'Comic Sans', cursive;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

header {
    background-color: var(--primary-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav {
    display: flex;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    margin-left: 1rem;
    gap: 1rem;
}

.logo h1 {
    color: white;
    font-size: 1.8rem;
}

.social-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    fill: white;
    transition: fill 0.3s ease;
}

.social-icon:hover {
    fill: #808080;
}

.theme-toggle {
    display: none;
}

.theme-icon .sun,
.theme-icon .moon {
    display: none;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: calc(100vh - 80px);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.game-card {
    background-color: var(--card-background);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-5px);
    background-color: var(--card-hover);
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card h3 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.game-card p {
    font-size: 0.8rem;
}

.game-thumbnail {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.square-thumbnail {
    aspect-ratio: 1/1;
    object-fit: cover;
}

.account-button {
    background-color: #808080;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Comic Sans MS', 'Comic Sans', cursive;
    transition: background-color 0.3s ease;
}

.account-button:hover {
    background-color: #666666;
}

.register-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    background-color: var(--card-background);
    border-radius: 8px;
}

.register-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.register-form input {
    padding: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #333;
    color: white;
}

.register-form button {
    background-color: #4CAF50;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.register-form button:hover {
    background-color: #45a049;
}

.error-message {
    color: #ff4444;
    font-size: 0.9rem;
    margin-top: 5px;
    display: none;
}

.user-email {
    color: white;
    font-family: 'Comic Sans MS', 'Comic Sans', cursive;
    font-size: 1rem;
    padding: 10px;
    background-color: #808080;
    border-radius: 5px;
}

@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
}

@media (min-width: 769px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.ad-container {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    padding: 5px;
    border-radius: 5px;
}

.game-page-ad {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    padding: 5px;
    border-radius: 5px;
}

#popup-ad {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }

  #popup-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  }

  #popup-content button {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: not-allowed;
    background: #ccc;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
  }
