/* Styles de base */
body {
    margin: 0;
    overflow: hidden;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: #fff;
    font-family: "Times New Roman", Times, serif;
    position: relative;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
}

img#album-cover {
    max-width: 80%;
    max-height: 80%;
    transform-origin: center;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    z-index: 2;
    will-change: transform;
    transform-style: preserve-3d;
}

img#album-cover.shake {
    animation: shake 0.4s ease;
    transform-style: preserve-3d;
}

/* Animations de base */
@keyframes sway {
    0% { transform: perspective(1000px) rotateX(0deg) rotateY(-5deg); }
    50% { transform: perspective(1000px) rotateX(0deg) rotateY(5deg); }
    100% { transform: perspective(1000px) rotateX(0deg) rotateY(-5deg); }
}

.swaying {
    animation: sway 5.2s ease-in-out infinite;
}

@keyframes sway-mobile {
    0% { transform: perspective(1000px) rotateX(0deg) rotateY(-7.8deg); }
    50% { transform: perspective(1000px) rotateX(0deg) rotateY(7.8deg); }
    100% { transform: perspective(1000px) rotateX(0deg) rotateY(-7.8deg); }
}

/* Styles du vinyle */
.vinyl-link {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    z-index: 4;
    cursor: pointer;
    text-decoration: none;
}

.vinyl-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.vinyl-rotate {
    width: 100%;
    height: 100%;
    position: relative;
    animation: spin 4s linear infinite;
}

.vinyl {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1a1a1a, #333);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.vinyl::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30%;
    height: 30%;
    background: #8a0c0d;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.vinyl::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10%;
    height: 10%;
    background: #333;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.grooves {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle at center,
        transparent 0,
        transparent 2px,
        rgba(255,255,255,0.1) 2px,
        rgba(255,255,255,0.1) 4px
    );
}

.music-note {
    position: absolute;
    top: 0;
    right: 0;
    color: #bd9a5a;
    font-size: 40px;
    z-index: 5;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    animation: float 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.reflection {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255,255,255,0.1) 45%,
        rgba(255,255,255,0.2) 50%,
        rgba(255,255,255,0.1) 55%,
        transparent 60%
    );
    transition: all 0.3s ease;
}

/* Effets hover sur le vinyle */
.vinyl-link:hover .vinyl {
    background: linear-gradient(45deg, #333, #4a4a4a);
    box-shadow: 0 0 20px rgba(255,255,255,0.4);
}

.vinyl-link:hover .music-note {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

.vinyl-link:hover .vinyl::before {
    background: #bd0d0e;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.3);
}

.vinyl-link:hover .reflection {
    background: linear-gradient(
        45deg,
        transparent 35%,
        rgba(255,255,255,0.2) 45%,
        rgba(255,255,255,0.3) 50%,
        rgba(255,255,255,0.2) 55%,
        transparent 65%
    );
}

/* Animations */
@keyframes float {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0% { text-shadow: 0 0 10px rgba(255,255,255,0.3), 0 0 5px rgba(0,0,0,0.4); }
    50% { text-shadow: 0 0 34px rgba(255,255,255,0.6), 0 0 17px rgba(255,255,255,0.2); }
    100% { text-shadow: 0 0 10px rgba(255,255,255,0.3), 0 0 5px rgba(0,0,0,0.4); }
}

@keyframes shake {
    0% { transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg)) translate(0, 0); }
    20% { transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg)) translate(-3px, 3px); }
    40% { transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg)) translate(3px, -3px); }
    60% { transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg)) translate(-3px, 2px); }
    80% { transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg)) translate(2px, -2px); }
    100% { transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg)) translate(0, 0); }
}

@keyframes brighten {
    0% {
        filter: brightness(1);
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    }
    100% {
        filter: brightness(3);
        box-shadow: 0 0 150px rgba(255, 255, 255, 1);
    }
}

@keyframes fragment-animation {
    0% {
        transform: translate(0, 0) rotateX(0) rotateY(0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotateX(var(--rx)) rotateY(var(--ry));
        opacity: 0;
    }
}

/* Classes d'animation */
.shake {
    animation: shake 0.4s ease;
}

.brighten {
    animation: brighten 2s forwards;
}

.fragmenting {
    animation: fragment-animation 3.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes fadeOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.riddle-text {
    position: absolute;
    top: 29px; /* Changé de 40px à 60px pour descendre encore plus */
    left: 50%;
    transform: translateX(-50%);
    color: #bd9a5a;
    font-family: "Times New Roman", Times, serif;
    font-size: 34px;
    text-align: center;
    z-index: 3;
    opacity: 0;
    display: none;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    animation: pulseGlow 2s infinite alternate ease-in-out;
    transition: opacity 0.8s ease-in-out;
}

@media (hover: none) and (pointer: coarse) {
    .riddle-text {
        bottom: 11%;
        top: auto;
        font-size: 20px; /* Réduit de 36px à 20px pour mobile */
        height: 36px;
        line-height: 36px;
    }
}

@media (min-device-width: 768px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) {
    .riddle-text {
        top: 1%;
        font-size: 22px; /* Ajusté pour les tablettes en mode paysage */
        height: 42px;
        line-height: 42px;
    }
}

/* Styles du compte à rebours */
#countdown {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #bd9a5a;
    font-family: "Times New Roman", Times, serif;
    font-size: 48px;
    text-align: center;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    animation: pulseGlow 2s infinite alternate ease-in-out;
    transition: opacity 0.8s ease-in-out;
}

#countdown span {
    display: inline-block;
    min-width: 60px;
}

#countdown .label {
    font-size: 24px;
    color: #8a0c0d;
    vertical-align: middle;
    margin-left: 5px;
}

#countdown .segment {
    margin: 0 10px;
}

/* Styles de fragmentation */
.fragment-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.fragment {
    position: absolute;
    background-size: 500% 500%;
    opacity: 1;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

/* Styles du footer et noscript */
footer {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    color: #bd9a5a;
    font-size: 18px;
    z-index: 3;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
    font-family: "Times New Roman", Times, serif;
}

noscript {
    color: #fff;
    background: #000;
    padding: 20px;
    font-size: 18px;
    position: relative;
    z-index: 5;
    font-family: "Times New Roman", Times, serif;
}

/* Media Queries */
@media (hover: none) and (pointer: coarse) {
    .swaying {
        animation: sway-mobile 3.2s ease-in-out infinite;
    }

    #countdown {
        bottom: 11%;
        top: auto;
        font-size: 36px; 
    }
    #countdown span {
        min-width: 40px; 
    }
    #countdown .segment {
        margin: 0 5px; 
    }
    #countdown .label {
        font-size: 20px; 
    }

    /* Styles pour le shake sur mobile */
    img#album-cover.shake {
        animation: shake 0.4s ease !important;
        transform-style: preserve-3d;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
}

@media (min-device-width: 768px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) {
    #countdown {
        top: 1%;
        bottom: auto;
        font-size: 42px;
        left: 50%;
        transform: translateX(-50%);
    }
}