html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: #050505;
    overflow: hidden;
}

#stage {
    width: 100vw;
    height: 100vh;
    display: grid;
    place-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.disc {
    width: min(82vw, 82vh);
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    background: black;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.08);
    transition:
        border-radius 1.2s ease,
        transform 1.2s ease,
        box-shadow 1.2s ease,
        filter 1.2s ease;
}

.disc video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* État initial : carré vibrant, silencieux */
.disc.idle {
    border-radius: 4%;
    animation: silentVibration 2.8s infinite ease-in-out;
    filter: contrast(1.08) saturate(1.12);
}

/* État actif : disque vinyle halluciné */
.disc.playing {
    border-radius: 50%;
    animation: vinylSpin 1.8s linear infinite;
    box-shadow:
        0 0 50px rgba(255, 255, 255, 0.12),
        inset 0 0 80px rgba(0, 0, 0, 0.65);
}

/* Sillons */
.grooves {
    pointer-events: none;
    opacity: 0;
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        repeating-radial-gradient(circle,
            rgba(255, 255, 255, 0.09) 0px,
            rgba(255, 255, 255, 0.09) 1px,
            transparent 2px,
            transparent 7px);
    mix-blend-mode: overlay;
    transition: opacity 1s ease;
}

.disc.playing .grooves {
    opacity: 0.55;
}

/* Étiquette centrale */
.label {
    pointer-events: none;
    opacity: 0;
    position: absolute;
    width: 23%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(0, 0, 0, 0.45));
    mix-blend-mode: screen;
    transition: opacity 1s ease;
}

.disc.playing .label {
    opacity: 0.8;
}

/* Trou central */
.hole {
    pointer-events: none;
    opacity: 0;
    position: absolute;
    width: 4%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: black;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transition: opacity 1s ease;
}

.disc.playing .hole {
    opacity: 1;
}

/* Reflet fixe, placé par-dessus le disque */
#stage::after {
    content: "";
    pointer-events: none;
    position: absolute;
    width: min(82vw, 82vh);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    opacity: 0;
    background:
        linear-gradient(120deg,
            transparent 0%,
            rgba(255, 255, 255, 0.16) 42%,
            transparent 56%);
    mix-blend-mode: screen;
    transition: opacity 1.2s ease;
}

#stage.playing::after {
    opacity: 0.45;
}

#hint {
    position: fixed;
    bottom: 6vh;
    font-family: monospace;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.45);
    transition: opacity 0.8s ease;
}

#stage.playing #hint {
    opacity: 0;
}

@keyframes silentVibration {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(1px, -1px) scale(1.005);
    }

    50% {
        transform: translate(-1px, 1px) scale(0.998);
    }

    75% {
        transform: translate(1px, 1px) scale(1.003);
    }
}

/* 33⅓ tours/minute ≈ 1 tour toutes les 1.8 secondes */
@keyframes vinylSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Tonearm / bras de lecture --- */

#stage {
    --arm-angle: -30deg;
}

/* Bras invisible par défaut */
.tonearm {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(36vw, 36vh);
    height: min(4vw, 4vh);
    z-index: 20;
    cursor: grab;
    user-select: none;
    touch-action: none;

    transform-origin: 92% 50%;
    transform:
        translate(calc(min(18vw, 18vh)),
            calc(-1 * min(12vw, 12vh))) rotate(var(--arm-angle));

    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.8s ease,
        filter 0.3s ease;
}

/* Le bras apparaît seulement quand le disque tourne */
#stage.playing .tonearm {
    opacity: 1;
    pointer-events: auto;
}

.tonearm.dragging {
    cursor: grabbing;
    filter: brightness(1.2) drop-shadow(0 0 12px rgba(255, 255, 255, 0.25));
}

/* Petite indication de manipulation */
.tonearm::after {
    content: "drag ↔";
    position: absolute;
    left: 18%;
    top: 120%;
    font-family: monospace;
    font-size: min(1.7vw, 1.7vh);
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

#stage.playing .tonearm:hover::after,
#stage.playing .tonearm.dragging::after {
    opacity: 1;
    transform: translateY(0);
}

.tonearm-pivot {
    position: absolute;
    right: 0;
    top: 50%;
    width: min(4vw, 4vh);
    height: min(4vw, 4vh);
    border-radius: 50%;
    transform: translate(50%, -50%);
    background:
        radial-gradient(circle at 35% 35%, #f1f1f1, #8f8f8f 52%, #2c2c2c 100%);
    box-shadow:
        0 0 14px rgba(255, 255, 255, 0.2),
        inset 0 0 10px rgba(0, 0, 0, 0.6);
}

.tonearm-bar {
    position: absolute;
    left: 0;
    right: min(2vw, 2vh);
    top: 50%;
    height: max(5px, min(0.65vw, 0.65vh));
    transform: translateY(-50%);
    border-radius: 999px;
    background:
        linear-gradient(180deg, #e6e6e6 0%, #7d7d7d 48%, #c9c9c9 100%);
    box-shadow:
        0 0 10px rgba(255, 255, 255, 0.12),
        inset 0 0 4px rgba(0, 0, 0, 0.4);
}

/* Tête plus grosse et plus stylée */
.tonearm-head {
    position: absolute;
    left: -0.7rem;
    top: 50%;
    width: min(4.5vw, 4.5vh);
    height: min(2.7vw, 2.7vh);
    transform: translate(-25%, -50%);
    border-radius: 0.55rem 0.25rem 0.25rem 0.55rem;
    background:
        linear-gradient(145deg, #f6f6f6 0%, #a9a9a9 50%, #4e4e4e 100%);
    box-shadow:
        0 0 12px rgba(255, 255, 255, 0.15),
        inset 0 0 5px rgba(0, 0, 0, 0.45);
}

/* Petit logo chat */
.tonearm-head::before {
    content: "🐈";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: min(2vw, 2vh);
    line-height: 1;
    filter: grayscale(1) contrast(1.3);
    opacity: 0.9;
}

/* Pointe / aiguille */
.tonearm-head::after {
    content: "";
    position: absolute;
    left: 16%;
    top: 100%;
    width: 2px;
    height: min(1.9vw, 1.9vh);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-10%) rotate(6deg);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.35);
}

@keyframes headPulse {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.12);
    }
}

#stage.playing .tonearm-head {
    animation: headPulse 2.8s ease-in-out infinite;
}