* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #0a0a0a;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Variables de positionnement ajustées */
:root {
    --tv-left: 18%;
    --tv-top: 1.6%;
    --tv-width: 68vw;
    --tv-shift-down: 2.4vh;
    --tv-vert-scale: 0.95;
    
    /* Positionnement de la main */
    --hand-container-right: 1%; 
    --hand-container-bottom: -2%; 
    --hand-container-width: 35%;
    --hand-container-max-width: 520px;
    --hand-container-min-width: 320px;
}

/* Conteneur principal */
.hand-remote-container {
    position: fixed;
    right: var(--hand-container-right);
    bottom: var(--hand-container-bottom);
    width: var(--hand-container-width);
    max-width: var(--hand-container-max-width);
    min-width: var(--hand-container-min-width);
    height: auto;
    z-index: 20;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Image de la main uniquement (le corps) */
.hand-image {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    z-index: 21; 
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
    image-rendering: auto;
    transform: scale(1.05);
}

/* Télécommande principale (Corps BLANC et IMMERSIF) */
.remote-overlay {
    position: absolute;
    top: 60%;         
    left: 46%; 
    transform: translate(-50%, -50%) rotate(-5deg) scale(1.1); 
    
    width: 32%;
    min-width: 100px;
    max-width: 135px;
    height: auto;
    aspect-ratio: 1/2.8;
    background: #f0f0f0; 
    border-radius: 25px; 
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5), inset 0 0 5px rgba(255, 255, 255, 0.4); 
    padding: 10px 0; 
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 23; 
    pointer-events: auto;
    transition: all 0.2s ease;
}

/* Titre "Télécommande" */
.remote-title {
    position: absolute;
    top: 5%;
    left: 15%;
    color: #444;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Écran de la télécommande (style LCD) */
.remote-screen {
    position: absolute;
    top: 10%; 
    left: 50%;
    transform: translateX(-50%);
    width: 70%; 
    height: 10%; 
    background: #050505; 
    border: 1px solid #1a1a1a; 
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem; 
    color: #0f0; /* Couleur par défaut (OFF) */
    text-shadow: 0 0 5px rgba(0,255,0,0.8);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    z-index: 24;
    font-weight: bold;
    border-radius: 4px;
    box-shadow: inset 0 0 8px rgba(0, 255, 0, 0.15); 
    opacity: 0.5; /* Plus terne en mode OFF */
    transition: all 0.3s ease;
}

/* NOUVEAU: État ON de la télécommande */
.remote-screen.on-mode {
    background: #004d00; /* Un fond plus sombre quand allumé */
    border: 1px solid #33ff33;
    color: #33ff33;
    text-shadow: 0 0 7px rgba(51, 255, 51, 0.9);
    box-shadow: inset 0 0 10px rgba(51, 255, 51, 0.3);
    opacity: 1;
}

/* Grille des boutons numérotés */
.number-buttons-grid {
    position: absolute;
    top: 30%; 
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 8px; 
    z-index: 25;
}

.remote-button {
    width: 100%;
    aspect-ratio: 1;
    background: #333; 
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff; 
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 26;
    font-weight: bold;
    font-size: 1rem; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 0 3px rgba(255,255,255,0.1);
    border: none;
}

.remote-button:hover {
    background: #555;
    transform: scale(1.08);
}
/* AJOUTÉ: Amélioration de la fluidité des boutons */
.remote-button:active,
.channel-button:active {
    transform: scale(0.9) translateZ(0); /* Plus net et fluide */
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 0 5px rgba(0,0,0,0.1);
    transition: transform 0.1s ease-out; /* Transition de clic rapide */
}

/* Style du bouton Power central */
.power-button {
    background: #ff2828; 
    color: transparent; 
    grid-column: 2 / span 1; 
    box-shadow: 0 0 15px rgba(255, 40, 40, 0.8);
    font-size: 0; 
}

.power-button:hover {
    background: #ff5555;
}

.power-button:active {
    background: #dd1111;
    transform: scale(0.90);
}

/* Boutons de Changement de Chaîne simplifiés (+/-) */
.channel-controls-plus-minus {
    position: absolute;
    top: 75%; 
    left: 50%;
    transform: translateX(-50%);
    width: 60%; 
    display: flex;
    justify-content: space-between;
    z-index: 27;
}

.channel-controls-plus-minus .channel-button {
    width: 35px;
    height: 35px;
    background: #333; 
    border-radius: 50%; 
    font-size: 1.5rem;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 0 3px rgba(255,255,255,0.1);
}

.channel-controls-plus-minus .channel-button:hover {
    background: #555;
}

/* NOUVEAU STYLE : Image du pouce par dessus la télécommande */
.hand-thumb-overlay {
    position: absolute;
    width: 100%;
    height: auto;
    display: block;
    transform: scale(1.05) translate(15px, -10px) rotate(15deg);
    z-index: 24; 
    pointer-events: none; 
}


/* --- Styles de la TV et du Background --- */

/* Écran de télévision */
.tv-screen {
    width: 96%;
    height: 82%;
    background-color: #000;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
}

.tv-screen.off {
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tv-logo {
    color: #2a5a2a;
    font-size: 2.5rem;
    letter-spacing: 8px;
    text-transform: uppercase;
    opacity: 0.5;
}

/* MODIFICATION CLÉ : Masque les effets d'animation du bruit */
.static-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Conserve la définition du bruit mais le masque */
    opacity: 0; 
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.35s ease;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    /* Conserve la définition du scan line mais le masque */
    opacity: 0; 
    z-index: 6;
    transition: opacity 0.35s linear, top 2s linear;
}

@keyframes staticNoise {
    0% { background-position: 0 0; }
    100% { background-position: 0 10px; }
}

@keyframes scanLine {
    0% { top: 0%; opacity: 0.8; }
    100% { top: 100%; opacity: 0; }
}
/* FIN MODIFICATION CLÉ */


.image-fade-in {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 1;
    animation: fadeIn 2s forwards;
    z-index: 4;
}

@keyframes fadeIn {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.channel-content {
    width: 100%;
    height: 100%;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s;
}

.channel-content.active {
    display: block;
    opacity: 1;
}

.channel-1 {
    background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* AJUSTEMENT POUR ÉVITER LE CONTOUR VERT PENDANT LA LECTURE VIDÉO */
.tv-screen.on {
    background-color: #000 !important; 
    transition: background-color 0.5s ease, box-shadow 0.5s ease;
    box-shadow: none; 
}

/* La classe 'animating' est utilisée spécifiquement pour la vidéo YouTube */
.tv-screen.animating {
    background-color: #000 !important; 
    transition: none;
    box-shadow: none; 
}

/* Masque le contenu de la chaîne et le logo quand la TV est OFF */
.tv-screen.off .channel-content {
    display: none !important;
}

.tv-screen.off .tv-logo {
    opacity: 0 !important;
}

/* S'assurer que le logo/off est masqué dans l'état animé/on */
.tv-screen.animating .tv-logo,
.tv-screen.on .tv-logo {
    display: none;
}

/* NOUVEAU: Style du conteneur de texte pour la Chaîne 4 */
.ia-glitch-text {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding: 30px;
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: center;
    background-color: #000;
    font-family: 'Courier New', monospace;
}

/* NOUVEAU: Classe pour l'effet de Glitch */
.glitch-active {
    position: relative;
    /* Démarre l'animation de glitch */
    animation: glitch 0.7s infinite linear alternate-reverse;
}

.glitch-active::before,
.glitch-active::after {
    content: attr(data-text); /* Récupère le texte de l'attribut data-text */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-active::before {
    left: 2px;
    text-shadow: -2px 0 red;
    background: #000; /* Assure que le fond ne soit pas visible */
    clip: rect(44px, 450px, 56px, 0); /* Zone de glitch aléatoire (ajuster) */
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch-active::after {
    left: -2px;
    text-shadow: -2px 0 blue;
    background: #000;
    clip: rect(85px, 450px, 100px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

/* NOUVEAU: Keyframes pour le Glitch */
@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-anim-1 {
    0% { clip: rect(2px, 9999px, 50px, 0); }
    10% { clip: rect(10px, 9999px, 80px, 0); }
    20% { clip: rect(25px, 9999px, 60px, 0); }
    30% { clip: rect(100px, 9999px, 110px, 0); }
    40% { clip: rect(5px, 9999px, 20px, 0); }
    50% { clip: rect(70px, 9999px, 90px, 0); }
    60% { clip: rect(15px, 9999px, 35px, 0); }
    70% { clip: rect(85px, 9999px, 105px, 0); }
    80% { clip: rect(35px, 9999px, 75px, 0); }
    90% { clip: rect(60px, 9999px, 100px, 0); }
    100% { clip: rect(95px, 9999px, 120px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(20px, 9999px, 30px, 0); }
    10% { clip: rect(40px, 9999px, 55px, 0); }
    20% { clip: rect(70px, 9999px, 85px, 0); }
    30% { clip: rect(10px, 9999px, 40px, 0); }
    40% { clip: rect(50px, 9999px, 70px, 0); }
    50% { clip: rect(80px, 9999px, 100px, 0); }
    60% { clip: rect(25px, 9999px, 45px, 0); }
    70% { clip: rect(90px, 9999px, 110px, 0); }
    80% { clip: rect(5px, 9999px, 25px, 0); }
    90% { clip: rect(55px, 9999px, 75px, 0); }
    100% { clip: rect(110px, 9999px, 125px, 0); }
}

/* --- Le reste des styles de fond et responsive (inchangé) --- */

.thumb-overlay {
    position: absolute;
    top: 28%;
    left: 46%;
    width: 9%;
    height: auto;
    aspect-ratio: 1;
    z-index: 29;
    opacity: 0;
    pointer-events: none;
    transform-origin: center bottom;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6));
}

.remote-at-thumb {
    display: none; 
    position: absolute;
    top: 28%;
    left: 46%;
    width: 9%;
    height: auto;
    aspect-ratio: 1/2.8;
    z-index: 22;
    transform: rotate(-12deg) scale(0.7);
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.8));
    pointer-events: none;
}

.remote-at-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes thumbPress {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    30% {
        transform: translateY(-9px) scale(1.15);
        opacity: 1;
    }
    70% {
        transform: translateY(5px) scale(0.95);
        opacity: 0.9;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
}

.thumb-overlay.pressing {
    animation: thumbPress 0.6s ease-out;
}

/* Fond d'écran */
.background-illustration {
    position: fixed;
    inset: 0;
    background: #050505 url('images/Plan de travail.png') center center / cover no-repeat;
    filter: blur(6px) brightness(0.4);
    transform: scale(1.02);
    z-index: -2;
}

.center-illustration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: transparent url('images/Plan de travail.png') center center no-repeat;
    background-size: 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
}

.background-tv-mask {
    position: fixed;
    left: var(--tv-left);
    top: var(--tv-top);
    width: var(--tv-width);
    aspect-ratio: 16/9;
    pointer-events: none;
    z-index: 5;
    background: linear-gradient(145deg, #1a1a1a, #0a0a0a);
    border-radius: 12px;
    box-shadow: 
        0 0 0 8px #333,
        0 0 22px rgba(0, 255, 0, 0.45),
        inset 0 0 16px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(2px) saturate(0.95);
    -webkit-backdrop-filter: blur(2px) saturate(0.95);
}

/* Télévision interactive */
.interactive-tv {
    position: fixed;
    left: var(--tv-left);
    top: var(--tv-top);
    width: var(--tv-width);
    max-height: calc(80vh);
    max-width: none;
    z-index: 6;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-frame {
    width: 100%;
    aspect-ratio: 16/9;
    height: auto;
    max-height: 80vh;
    background: linear-gradient(145deg, #1a1a1a, #0a0a0a);
    border-radius: 12px;
    box-shadow: 
        0 0 0 8px #333,
        0 0 22px rgba(0, 255, 0, 0.45),
        inset 0 0 16px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transform-origin: top center;
}

.interactive-tv .tv-frame,
.background-tv-mask {
    transform: translateY(var(--tv-shift-down)) scaleY(var(--tv-vert-scale));
    transform-origin: top center;
}

/* Ajustements responsive */
@media (min-width: 1920px) {
    .hand-remote-container {
        --hand-container-right: 6%;
        --hand-container-width: 32%;
        --hand-container-max-width: 580px;
    }
    
    .remote-overlay {
        left: 47.5%;
        transform: translate(-50%, -50%) rotate(-12deg) scale(0.95);
        width: 30%;
        max-width: 150px;
    }
    
    .thumb-overlay,
    .remote-at-thumb {
        top: 29%;
        left: 45.5%;
        width: 8%;
    }
}

@media (max-width: 1440px) {
    .hand-remote-container {
        --hand-container-right: 10%;
        --hand-container-width: 38%;
        --hand-container-max-width: 480px;
    }
    
    .remote-overlay {
        left: 47%;
        transform: translate(-50%, -50%) rotate(-12deg) scale(0.88);
        width: 34%;
    }
    
    .thumb-overlay,
    .remote-at-thumb {
        top: 27%;
        left: 45%;
        width: 9.5%;
    }
}

@media (max-width: 1024px) {
    .hand-remote-container {
        --hand-container-right: 12%;
        --hand-container-width: 42%;
        --hand-container-max-width: 450px;
    }
    
    .remote-overlay {
        left: 46.5%;
        transform: translate(-50%, -50%) rotate(-12deg) scale(0.85);
        width: 36%;
    }
    
    .thumb-overlay,
    .remote-at-thumb {
        top: 26%;
        left: 44.5%;
        width: 10%;
    }
}

@media (max-width: 768px) {
    .hand-remote-container {
        display: none;
    }
    
    .tv-frame {
        height: 400px;
    }
    
    .remote-overlay {
        position: relative;
        margin: 30px auto;
        width: 220px;
        height: 330px;
        transform: none;
        left: 50%;
        top: 50%;
    }
}

@media (max-height: 800px) {
    .hand-remote-container {
        --hand-container-bottom: -2%;
    }
}