body {
    margin: 0;
    padding: 0;
    background: #000;
    overflow: hidden;
    font-family: 'Oxygen', sans-serif;
    color: #fff;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#ship {
    position: fixed;
    bottom: 100px;
    left: 50%;
    width: 60px;
    height: 60px;
    background-image: url('images/ship.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform: translateX(-50%);
    transition: left 0.3s ease-out;
    z-index: 100;
    animation: shipHover 2s infinite ease-in-out;
}

@keyframes shipHover {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-10px);
    }
}

#stars {
    position: absolute;
    width: 100%;
    height: 100%;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.5s ease;
    box-shadow: 0 0 10px #fff, 0 0 20px #fff;
    animation: twinkle 1.5s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

#finalMessage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #000428 0%, #dd777d 100%);
}

.text3d {
    font-size: 8em;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    animation: float 3s ease-in-out infinite;
}

.new-year-message {
    margin-top: 2rem;
    text-align: center;
    animation: messageGlow 2s infinite alternate;
    font-family: 'Oxygen', sans-serif;
}

.new-year-message h1 {
    font-size: 3em;
    margin: 0;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.new-year-message p {
    font-size: 1.5em;
    margin: 1rem 0;
    color: #ffffff;
    font-weight: 300;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

@keyframes messageGlow {
    from {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    }
    to {
        text-shadow: 0 0 20px rgba(255, 255, 255, 1);
    }
}

#background-stars {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.background-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    animation: starMove linear infinite;
}

@keyframes starMove {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(100vh);
    }
}

.planet {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    transition: transform 0.3s ease;
}

.planet::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3));
}

.planet.crimson {
    background: linear-gradient(45deg, #8B0000, #FF4444);
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.6);
}

.planet.exotic {
    background: linear-gradient(45deg, #228B22, #32CD32);
    box-shadow: 0 0 30px rgba(34, 139, 34, 0.6);
}

.planet.ocean {
    background: linear-gradient(45deg, #000080, #4169E1);
    box-shadow: 0 0 30px rgba(0, 0, 128, 0.6);
}

.planet.mars { background: linear-gradient(45deg, #ff4500, #ff6347); }
.planet.venus { background: linear-gradient(45deg, #ffd700, #ffa500); }
.planet.neptune { background: linear-gradient(45deg, #4169e1, #1e90ff); }
.planet.jupiter { background: linear-gradient(45deg, #deb887, #d2691e); }

.planet.landing-zone {
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.2); }
    100% { transform: scale(1); }
}

#constellation {
    width: 600px;
    height: 200px;
    position: relative;
    margin: 2em auto;
}

.constellation-star {
    position: absolute;
    background-color: #ffd700;
    border-radius: 50%;
    box-shadow: 0 0 15px #ffd700, 0 0 25px #ffd700;
    animation: constellationTwinkle 2s infinite ease-in-out;
    width: 4px;
    height: 4px;
}

/* Positions précises pour former "2025" */
/* Chiffre 2 */
.digit-2 { left: 0; width: 100px; }
.digit-2 .constellation-star:nth-child(1) { left: 0; top: 0; }
.digit-2 .constellation-star:nth-child(2) { left: 50px; top: 0; }
.digit-2 .constellation-star:nth-child(3) { left: 100px; top: 50px; }
.digit-2 .constellation-star:nth-child(4) { left: 50px; top: 100px; }
.digit-2 .constellation-star:nth-child(5) { left: 0; top: 100px; }

/* Chiffre 0 */
.digit-0 { left: 150px; width: 100px; }
.digit-0 .constellation-star:nth-child(1) { left: 50px; top: 0; }
.digit-0 .constellation-star:nth-child(2) { left: 100px; top: 50px; }
.digit-0 .constellation-star:nth-child(3) { left: 50px; top: 100px; }
.digit-0 .constellation-star:nth-child(4) { left: 0; top: 50px; }

/* Chiffre 2 */
.digit-2-2 { left: 300px; width: 100px; }
.digit-2-2 .constellation-star:nth-child(1) { left: 0; top: 0; }
.digit-2-2 .constellation-star:nth-child(2) { left: 50px; top: 0; }
.digit-2-2 .constellation-star:nth-child(3) { left: 100px; top: 50px; }
.digit-2-2 .constellation-star:nth-child(4) { left: 50px; top: 100px; }
.digit-2-2 .constellation-star:nth-child(5) { left: 0; top: 100px; }

/* Chiffre 5 */
.digit-5 { left: 450px; width: 100px; }
.digit-5 .constellation-star:nth-child(1) { left: 100px; top: 0; }
.digit-5 .constellation-star:nth-child(2) { left: 0; top: 0; }
.digit-5 .constellation-star:nth-child(3) { left: 0; top: 50px; }
.digit-5 .constellation-star:nth-child(4) { left: 100px; top: 50px; }
.digit-5 .constellation-star:nth-child(5) { left: 100px; top: 100px; }
.digit-5 .constellation-star:nth-child(6) { left: 0; top: 100px; }

#welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #000428 0%, #004e92 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.welcome-content {
    text-align: center;
    padding: 2em;
    color: #ffffff;
    max-width: 600px;
    animation: welcomeFade 1s ease-in;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    box-sizing: border-box;
}

.welcome-content .logo {
    width: 200px;
    height: auto;
    margin-bottom: 1.5em;
}

.welcome-content h1 {
    font-family: 'Oxygen', sans-serif;
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 0.8em;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.welcome-content p {
    font-family: 'Oxygen', sans-serif;
    font-size: 1.2em;
    line-height: 1.6;
    margin-bottom: 1em;
    font-weight: 300;
}

.welcome-content .instructions {
    font-weight: 400;
    color: #a0e4ff;
    margin-bottom: 1.5em;
    line-height: 1.4;
}

#start-game {
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
    padding: 1em 2em;
    font-size: 1.2em;
    font-family: 'Oxygen', sans-serif;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 1em;
}

/* Styles pour l'écran d'accueil sur mobile */
@media screen and (max-width: 768px) {
    .welcome-content {
        padding: 1.5em;
        justify-content: space-around;
        height: 100vh;
    }

    .welcome-content .logo {
        width: 150px;
        margin-bottom: 1em;
    }

    .welcome-content h1 {
        font-size: 1.8em;
        margin-bottom: 0.6em;
        padding: 0 0.5em;
    }

    .welcome-content p {
        font-size: 1em;
        margin-bottom: 0.8em;
        padding: 0 0.5em;
    }

    .welcome-content .instructions {
        font-size: 0.9em;
        margin-bottom: 1.2em;
        padding: 0 0.5em;
    }

    #start-game {
        padding: 0.8em 1.6em;
        font-size: 1em;
        margin-top: 0.8em;
    }
}

/* Ajustements pour les très petits écrans */
@media screen and (max-width: 480px) {
    .welcome-content {
        padding: 1em;
    }

    .welcome-content .logo {
        width: 120px;
        margin-bottom: 0.8em;
    }

    .welcome-content h1 {
        font-size: 1.5em;
        margin-bottom: 0.5em;
    }

    .welcome-content p {
        font-size: 0.9em;
        margin-bottom: 0.6em;
        line-height: 1.4;
    }

    .welcome-content .instructions {
        font-size: 0.8em;
        margin-bottom: 1em;
        line-height: 1.3;
    }

    #start-game {
        padding: 0.7em 1.4em;
        font-size: 0.9em;
        margin-top: 0.6em;
    }
}

/* Ajustements pour les écrans en mode paysage sur mobile */
@media screen and (max-height: 480px) and (orientation: landscape) {
    .welcome-content {
        padding: 0.8em;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.5em;
    }

    .welcome-content .logo {
        width: 80px;
        margin-bottom: 0;
        margin-right: 1em;
    }

    .welcome-content h1 {
        font-size: 1.2em;
        margin-bottom: 0.3em;
        flex: 1 1 calc(100% - 100px);
    }

    .welcome-content p {
        font-size: 0.8em;
        margin-bottom: 0.3em;
        flex: 1 1 100%;
    }

    .welcome-content .instructions {
        font-size: 0.7em;
        margin-bottom: 0.5em;
        flex: 1 1 100%;
    }

    #start-game {
        padding: 0.5em 1em;
        font-size: 0.8em;
        margin-top: 0.3em;
    }
}

#message-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: auto;
    min-width: 300px;
    max-width: calc(100vw - 20px);
    display: none;
    pointer-events: none;
}

.dialog-box {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: transparent;
    margin: 0 10px;
}

#portrait {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 3px solid #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: portraitFloat 3s infinite ease-in-out;
    flex-shrink: 0;
}

.message-bubble {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-left: 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    min-width: 200px;
    max-width: 400px;
}

.bubble-pointer {
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 12px solid rgba(255, 255, 255, 0.5);
}

.bubble-pointer::after {
    content: '';
    position: absolute;
    left: 2px;
    top: -10px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid rgba(0, 0, 0, 0.9);
}

#message {
    color: #ffffff;
    font-size: 1.2em;
    line-height: 1.4;
    text-align: left;
    margin: 0;
    padding: 0;
    font-family: 'Oxygen', sans-serif;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    white-space: pre-line;
}

/* Styles spécifiques pour chaque planète */
.dialog-box.crimson .message-bubble {
    border-color: rgba(255, 68, 68, 0.7);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
}

.dialog-box.crimson .bubble-pointer {
    border-right-color: rgba(255, 68, 68, 0.7);
}

.dialog-box.exotic .message-bubble {
    border-color: rgba(50, 205, 50, 0.7);
    box-shadow: 0 0 20px rgba(50, 205, 50, 0.4);
}

.dialog-box.exotic .bubble-pointer {
    border-right-color: rgba(50, 205, 50, 0.7);
}

.dialog-box.ocean .message-bubble {
    border-color: rgba(65, 105, 225, 0.7);
    box-shadow: 0 0 20px rgba(65, 105, 225, 0.4);
}

.dialog-box.ocean .bubble-pointer {
    border-right-color: rgba(65, 105, 225, 0.7);
}

@keyframes portraitFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

/* Styles pour le logo */
.logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 2em;
    animation: logoGlow 2s infinite alternate;
}

.final-logo {
    max-width: 150px;
    margin-bottom: 1em;
}

@keyframes logoGlow {
    from { filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5)); }
    to { filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8)); }
}

/* Watermark */
#watermark {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0.3;
    pointer-events: none;
}

.watermark-logo {
    width: 50px;
    height: auto;
    filter: brightness(0.7);
}

/* Copyright */
#copyright {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9998;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Oxygen', sans-serif;
    font-size: 0.8em;
    line-height: 1.4;
    text-align: left;
}

#copyright p {
    margin: 0;
    padding: 0;
}

/* Optimisations de performance */
.planet, .star, .background-star {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Amélioration de la sécurité des animations */
@media (prefers-reduced-motion: reduce) {
    .logo, .planet, .star, .background-star, .text3d, #portrait, #announcement {
        animation: none !important;
        transition: none !important;
    }
}

#announcement {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 1em 2em;
    border-radius: 50px;
    font-family: 'Oxygen', sans-serif;
    font-size: 1.2em;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 1000;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 0, 255, 0.3);
    animation: none;
}

#announcement.visible {
    opacity: 1;
    animation: alertBlink 1s infinite;
}

@keyframes alertBlink {
    0% {
        background: rgba(0, 0, 0, 0.8);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 0 20px rgba(0, 0, 255, 0.3);
    }
    50% {
        background: rgba(255, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.8);
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
    }
    100% {
        background: rgba(0, 0, 0, 0.8);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 0 20px rgba(0, 0, 255, 0.3);
    }
}

/* Styles responsives globaux */
@media screen and (max-width: 768px) {
    /* Ajustements pour le vaisseau */
    #ship {
        width: 40px;
        height: 40px;
        bottom: 60px;
    }

    /* Ajustements pour les planètes */
    .planet {
        width: 60px;
        height: 60px;
    }

    /* Ajustements pour la boîte de dialogue */
    #message-container {
        max-width: calc(100vw - 20px);
    }

    .dialog-box {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        margin: 0 10px;
    }

    #portrait {
        width: 80px;
        height: 80px;
    }

    .message-bubble {
        margin-left: 0;
        padding: 15px;
        min-width: 150px;
    }

    .bubble-pointer {
        left: 50%;
        top: -12px;
        transform: translateX(-50%) rotate(-90deg);
    }

    #message {
        font-size: 1em;
    }

    /* Ajustements pour l'écran final */
    .text3d {
        font-size: 5em;
    }

    .new-year-message h1 {
        font-size: 2.5em;
    }

    .new-year-message p {
        font-size: 1.2em;
    }

    .final-logo {
        width: 60%;
        max-width: 180px;
    }
}

/* Ajustements pour les très petits écrans */
@media screen and (max-width: 480px) {
    /* Ajustements pour le vaisseau */
    #ship {
        width: 30px;
        height: 30px;
        bottom: 40px;
    }

    /* Ajustements pour les planètes */
    .planet {
        width: 45px;
        height: 45px;
    }

    /* Ajustements pour la boîte de dialogue */
    #portrait {
        width: 60px;
        height: 60px;
    }

    .message-bubble {
        padding: 12px;
    }

    #message {
        font-size: 0.9em;
    }

    /* Ajustements pour l'écran final */
    .text3d {
        font-size: 3.5em;
    }

    .new-year-message h1 {
        font-size: 2em;
    }

    .new-year-message p {
        font-size: 1em;
    }

    .final-logo {
        width: 50%;
        max-width: 150px;
    }

    /* Ajustement du watermark */
    .watermark-logo {
        width: 35px;
    }
}

/* Ajustements pour les écrans en mode paysage sur mobile */
@media screen and (max-height: 480px) and (orientation: landscape) {
    #ship {
        bottom: 30px;
    }

    .planet {
        width: 40px;
        height: 40px;
    }

    #message-container {
        max-height: 80vh;
    }

    .dialog-box {
        padding: 10px;
    }

    #portrait {
        width: 50px;
        height: 50px;
    }

    .message-bubble {
        padding: 10px;
    }

    .text3d {
        font-size: 3em;
    }

    .new-year-message h1 {
        font-size: 1.8em;
        margin: 0.5em 0;
    }

    .new-year-message p {
        font-size: 0.9em;
        margin: 0.5em 0;
    }

    .welcome-content {
        padding: 0.5em;
    }

    .welcome-content h1 {
        font-size: 1.5em;
        margin-bottom: 0.5em;
    }

    .welcome-content p {
        font-size: 0.9em;
        margin-bottom: 0.5em;
    }

    .welcome-content .instructions {
        font-size: 0.8em;
        margin-bottom: 1em;
    }

    #start-game {
        padding: 0.6em 1.2em;
        font-size: 0.9em;
    }

    .logo {
        max-width: 120px;
        margin-bottom: 0.5em;
    }
}

/* Ajustements pour les grands écrans */
@media screen and (min-width: 1200px) {
    .planet {
        width: 100px;
        height: 100px;
    }

    #ship {
        width: 70px;
        height: 70px;
        bottom: 120px;
    }

    .text3d {
        font-size: 10em;
    }

    .new-year-message h1 {
        font-size: 4em;
    }

    .new-year-message p {
        font-size: 1.8em;
    }
}

/* Styles pour l'écran d'accueil sur mobile */
@media screen and (max-width: 768px) {
    .welcome-content {
        padding: 1em;
        max-width: 100%;
    }

    .welcome-content h1 {
        font-size: 1.8em;
        margin-bottom: 0.8em;
    }

    .welcome-content p {
        font-size: 1em;
        margin-bottom: 1em;
    }

    .welcome-content .instructions {
        font-size: 0.9em;
        margin-bottom: 1.5em;
    }

    #start-game {
        padding: 0.8em 1.6em;
        font-size: 1em;
    }

    .logo {
        width: 80%;
        max-width: 200px;
        height: auto;
        margin-bottom: 1em;
    }
}

/* Ajustements supplémentaires pour les très petits écrans */
@media screen and (max-width: 480px) {
    .welcome-content h1 {
        font-size: 1.5em;
    }

    .welcome-content p {
        font-size: 0.9em;
    }

    .welcome-content .instructions {
        font-size: 0.8em;
    }

    #start-game {
        padding: 0.7em 1.4em;
        font-size: 0.9em;
    }
}

/* Style du footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 10000;
    padding: 5px 0;
    font-size: 0.8em;
    text-align: center;
}

.copyright {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-family: 'Oxygen', sans-serif;
    font-weight: 300;
}

.copyright a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.3s ease;
}

.copyright a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Ajustement pour mobile */
@media screen and (max-width: 480px) {
    footer {
        padding: 3px 0;
        font-size: 0.7em;
    }
}

/* Ajustement pour le mode paysage */
@media screen and (max-height: 480px) and (orientation: landscape) {
    footer {
        padding: 2px 0;
        font-size: 0.65em;
    }
}

#music-control {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.music-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.music-button:hover {
    transform: scale(1.1);
}

.music-button img {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
}