:root {
    --primary-color: #FF4136;
    --secondary-color: #FF851B;
    --background-color: #1a1a2e;
    --text-color: #e0e0e0;
    --header-height: 80px;
    --transition-speed: 0.3s;
    --glow-color: #FF4136;
}

.light-theme {
    --background-color: #f0f0f0;
    --text-color: #333;
    --glow-color: #FF851B;
}

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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Game background */
#game-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8), rgba(26, 26, 46, 0.6));
    z-index: -1;
}

/* Header styles */
.game-header {
    background-color: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.game-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.logo-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--glow-color);
}

.nav-links {
    display: flex;
    list-style: none;
    transition: transform var(--transition-speed), opacity var(--transition-speed);
}

.nav-links li {
    margin: 0 15px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: color var(--transition-speed);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease-in-out;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
}

.nav-controls {
    display: flex;
    align-items: center;
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 20px;
    color: var(--text-color);
    transition: transform var(--transition-speed);
}

#theme-toggle:hover {
    transform: rotate(30deg);
}

#theme-toggle svg {
    width: 24px;
    height: 24px;
}

.cta-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
    display: inline-block;
}

.cta-button:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 0 15px var(--glow-color);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: all var(--transition-speed);
}

/* Hero section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: var(--header-height);
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--glow-color);
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from {
        text-shadow: 0 0 20px var(--glow-color);
    }
    to {
        text-shadow: 0 0 30px var(--glow-color), 0 0 40px var(--glow-color);
    }
}

.game-subtitle {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.cta-group {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.play-button, .secondary-button {
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
    display: inline-block;
}

.play-button {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 20px var(--glow-color);
}

.play-button:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--glow-color);
}

.secondary-button {
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--text-color);
}

.secondary-button:hover {
    background-color: var(--text-color);
    color: var(--background-color);
}

/* Game sections */
.game-section {
    padding: 100px 0;
    position: relative;
}

.section-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    margin-bottom: 50px;
    text-align: center;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--glow-color);
}

.content-wrapper {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

/* About section */
.creator-info {
    display: flex;
    align-items: center;
    margin-top: 30px;
}

.creator-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-right: 20px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 15px var(--glow-color);
}

/* How to play section */
.game-instructions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.instruction-step {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: transform var(--transition-speed);
}

.instruction-step:hover {
    transform: translateY(-10px);
}

.step-number {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Leaderboard section */
.leaderboard-wrapper {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 15px;
    text-align: left;
}

.leaderboard-table th {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    color: var(--primary-color);
    text-transform: uppercase;
}

.leaderboard-table tbody tr {
    background: rgba(255, 255, 255, 0.05);
    transition: transform var(--transition-speed);
}

.leaderboard-table tbody tr:hover {
    transform: scale(1.02);
}

/* Contact form */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 16px;
}

.form-group textarea {
    height: 150px;
    resize: vertical;
}

.submit-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: block;
    width: 100%;
}

.submit-button:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 0 15px var(--glow-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-right: 15px;
}

.username {
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
}

.logout-btn {
    background-color: rgba(254, 44, 85, 0.2);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Footer */
.game-footer {
    background-color: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    color: var(--text-color);
    padding: 50px 0 20px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.footer-bottom p {
    margin-bottom: 10px;
}

.footer-section {
    flex: 1;
    margin-right: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.footer-section ul {
    list-style-type: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a,
.footer-section p {
    color: var(--text-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.social-links a {
    color: var(--text-color);
    margin-right: 15px;
    font-size: 20px;
    transition: color var(--transition-speed);
}

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

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom a {
    color: var(--text-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.footer-bottom a:hover {
    color: var(--primary-color);
}

/* Responsive design */
@media (max-width: 768px) {
    .game-nav {
        flex-wrap: wrap;
    }

    .nav-links {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height));
        flex-direction: column;
        background-color: rgba(26, 26, 46, 0.95);
        padding: 20px 0;
        transition: left var(--transition-speed);
        justify-content: center;
        align-items: center;
    }

    .nav-links.show {
        left: 0;
    }

    .nav-links li {
        margin: 15px 0;
    }

    .hamburger {
        display: block;
        order: 1;
    }

    .logo {
        order: 0;
    }

    .nav-controls {
        order: 2;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

.hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    .game-title {
        font-size: 2rem;
    }

    .game-subtitle {
        font-size: 1.2rem;
    }

    .cta-group {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
    }

    .footer-section {
        margin-right: 0;
    }
}

/* Light theme improvements */
.light-theme .game-header,
.light-theme .game-footer {
    background-color: rgba(240, 240, 240, 0.9);
}

.light-theme .content-wrapper,
.light-theme .instruction-step,
.light-theme .leaderboard-wrapper,
.light-theme .contact-form {
    background: rgba(255, 255, 255, 0.4);
    color: #333;
}

.light-theme .footer-section p,
.light-theme .footer-section ul li a,
.light-theme .social-links a,
.light-theme .footer-bottom,
.light-theme .nav-links a,
.light-theme .secondary-button {
    color: #333;
}

.light-theme .hamburger span {
    background-color: #333;
}

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

.fade-in {
    animation: fadeIn 1s ease-out;
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-left {
    animation: slideInFromLeft 1s ease-out;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-right {
    animation: slideInFromRight 1s ease-out;
}

/* Optimisations */
.fade-in,
.slide-in-left,
.slide-in-right {
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .slide-in-left,
    .slide-in-right {
        animation: none;
    }
}

/* Amélioration de la performance */
.game-section,
.instruction-step,
.leaderboard-table tbody tr {
    will-change: transform;
}

/* Amélioration de l'accessibilité */
.cta-button:focus,
.secondary-button:focus,
.nav-links a:focus,
#theme-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Ajout d'un effet de transition pour une meilleure expérience utilisateur */
.content-wrapper,
.instruction-step,
.leaderboard-wrapper,
.contact-form {
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
}

.content-wrapper:hover,
.instruction-step:hover,
.leaderboard-wrapper:hover,
.contact-form:hover {
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Styles améliorés pour les boutons d'authentification */
.auth-button {
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-right: 15px;
    position: relative;
    overflow: hidden;
}

.auth-button:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(255, 65, 54, 0.3);
}

.auth-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, .5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.auth-button:hover::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(25, 25);
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* Styles améliorés pour la modal d'authentification */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s ease-out;
}

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

.modal-content {
    background-color: var(--background-color);
    margin: 10% auto;
    padding: 30px;
    border: 1px solid var(--primary-color);
    width: 90%;
    max-width: 400px;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    transform: translateY(-50px);
    opacity: 0;
    animation: slideIn 0.3s ease-out forwards;
}

@keyframes slideIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--primary-color);
}

.auth-tabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.auth-tab {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.auth-tab.active::after {
    transform: scaleX(1);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group input {
    width: 100%;
    padding: 10px 0;
    font-size: 16px;
    color: var(--text-color);
    border: none;
    border-bottom: 1px solid var(--text-color);
    outline: none;
    background: transparent;
    transition: border-color 0.3s ease;
}

.form-group label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 10px 0;
    font-size: 16px;
    color: var(--text-color);
    pointer-events: none;
    transition: 0.3s ease all;
}

.form-group input:focus ~ label,
.form-group input:valid ~ label {
    top: -20px;
    font-size: 14px;
    color: var(--primary-color);
}

.form-group input:focus {
    border-bottom: 2px solid var(--primary-color);
}

.submit-button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.submit-button:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(255, 65, 54, 0.3);
    transform: translateY(-3px);
}

/* Responsive design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20% auto;
    }
}