/* RESET ET BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    overflow: hidden;
}

#shade {
	background-image: url("/assets/Themes/rain.gif");
	background-size: 250px;
	opacity: 0.6;
	z-index: -10;
}

#shade,
#shade-2,
#shade-3 {
	float: left;
	height: 100%;
	left: 0;
	position: fixed;
	top: 0;
	width: 100%;
}

#shade-2 {
	background-image: url("/assets/Themes/dust-clipart-cloud-smoke-12.png");
	width: 200%;
	height: 200%;
	top: -50%;
	left: -50%;
	position: fixed;
}

#shade-3 {
	background-image: url("/assets/Themes/starsky.gif");
	background-size: 150px;
	opacity: 0.9;
	z-index: -20;
}

#bunting {
	background-image: url("/assets/Themes/glowstars.gif");
	background-size: 299px;
	float: left;
	height: 100px;
	opacity: 0.9;
	left: -50%;
	top: 25%;
	position: absolute;
	width: 200%;
	z-index: -2;
	transform: rotate(-25deg);
}

.spin-slow {
	animation-name: spin;
	animation-duration: 150s;
	animation-iteration-count: infinite;
	animation-timing-function: linear;
}

a {
	color: #f744ff;
	pointer-events: auto;
    text-decoration: none;
    font-size: 28px;
}
a:hover {
	color: #25ffbd;
}

/* TITRE DE LA PAGE */
.page-title {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #f8f8f0;
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
    z-index: 200;
    background: rgba(42,42,42,0.8);
    padding: 15px 30px;
    border-radius: 20px;
    border: 2px solid rgba(248,248,240,0.3);
    backdrop-filter: blur(10px);
}

.page-subtitle {
    font-size: 16px;
    margin-top: 8px;
    color: #ddd;
    font-weight: normal;
    font-style: italic;
}

/* CONTAINER PRINCIPAL - GARDE VOS DIMENSIONS */
.cubes-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1500px;
    overflow: hidden;
}

/* ZONE SCROLLABLE HORIZONTALE - MODIFIÉE */
.cubes-scroll-area {
    display: flex;
    gap: 0; /* Supprime le gap entre groupes */
    padding: 120px 80px;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    
    /* HAUTEUR FIXE pour 2 lignes + padding */
    height: calc(2 * 220px + 150px + 240px);
    
    scrollbar-width: none;
    -ms-overflow-style: none;
}


.cubes-scroll-area::-webkit-scrollbar {
    display: none;
}

.cube-group {
    /* GRILLE 2 LIGNES, COLONNES ILLIMITÉES */
    display: grid;
    grid-template-rows: repeat(2, 1fr); /* TOUJOURS 2 lignes */
    grid-auto-columns: 360px; /* Largeur de chaque colonne */
    grid-auto-flow: column; /* Les cubes vont vers la droite */
    
    gap: 150px 140px; /* Vos gaps actuels */
    
    /* LARGEUR s'adapte au nombre de cubes */
    width: max-content;
    min-width: calc(4 * 360px + 3 * 140px); /* Largeur pour 4 colonnes visibles */
    
    /* Pas de shrink */
    flex-shrink: 0;
    
    /* Centrage vertical */
    align-items: center;
}

.game-cube {
    position: relative;
    width: 220px;
    height: 220px;
    transform-style: preserve-3d;
    transition: transform 0.2s ease-out;
    cursor: pointer;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.6));
}

/* ANIMATION IDLE DISCRÈTE */
.game-cube.idle-spin {
    animation: discreteIdle 1.2s ease-in-out;
}

@keyframes discreteIdle {
    0% { transform: rotateY(0deg) rotateX(0deg); }
    25% { transform: rotateY(5deg) rotateX(2deg); }
    50% { transform: rotateY(-3deg) rotateX(-1deg); }
    75% { transform: rotateY(2deg) rotateX(3deg); }
    100% { transform: rotateY(0deg) rotateX(0deg); }
}

/* FACE DE LA TÉLÉ - ALIGNÉE SUR .game-cube (220px) */
.cube-face {
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid rgba(255,255,255,0.3);
}

/* COULEURS DES TÉLÉS - CORPS */
.cube-face:not(.front) {
    box-shadow: 
        inset 0 3px 10px rgba(255,255,255,0.6),
        inset 0 -3px 10px rgba(0,0,0,0.2),
        0 0 25px rgba(255,255,255,0.3);
}

/* THÈMES DE COULEURS */
/* Noir cathodique */
.game-cube.theme-retro .cube-face:not(.front) {
    background: linear-gradient(145deg, #3a3a3a 0%, #1a1a1a 100%);
    border-color: #555;
}

/* Vert foncé */
.game-cube.theme-green .cube-face:not(.front) {
    background: linear-gradient(145deg, #2d4a2d 0%, #1a2e1a 100%);
    border-color: #4a6b4a;
}

/* Violet GameCube */
.game-cube.theme-purple .cube-face:not(.front) {
    background: linear-gradient(145deg, #5d4e75 0%, #3d2e4d 100%);
    border-color: #7d6e95;
}

/* Blanc crème */
.game-cube.theme-cream .cube-face:not(.front) {
    background: linear-gradient(145deg, #f8f8f0 0%, #e8e8e0 100%);
    border-color: #fff;
}

/* DÉTAILS SUR LES FACES */
.cube-face.right::after,
.cube-face.left::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 12px;
    top: 25%;
    left: 15%;
    border-radius: 6px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.2), transparent);
    box-shadow: 0 20px rgba(0,0,0,0.15), 0 40px rgba(0,0,0,0.1);
}

.cube-face.top::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 12px;
    background: rgba(0,0,0,0.3);
    top: 20%;
    right: 25%;
    border-radius: 3px;
    box-shadow: 
        12px 0 rgba(0,0,0,0.25),
        24px 0 rgba(0,0,0,0.2),
        0 15px rgba(0,0,0,0.15),
        12px 15px rgba(0,0,0,0.1);
}

.cube-face.top::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 8px;
    background: rgba(0,0,0,0.2);
    bottom: 30%;
    left: 20%;
    border-radius: 4px;
}

.cube-face.back::before {
    content: '';
    position: absolute;
    width: 80%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(0,0,0,0.1) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    border-radius: 10px;
}

/* FACE AVANT - ÉCRAN CATHODIQUE */
.cube-face.front {
    background: linear-gradient(145deg, #2a2a2a 0%, #0a0a0a 100%);
    border: 8px solid #1a1a1a;
    box-shadow: 
        inset 0 0 30px rgba(0,0,0,0.9),
        inset 0 0 60px rgba(200,200,200,0.3),
        0 0 30px rgba(255,255,255,0.4);
    overflow: hidden;
}

/* ÉCRAN CATHODIQUE BOMBÉ */
.screen-surface {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 10px;
    background: radial-gradient(ellipse at center, 
        rgba(20,20,20,0.2) 0%,
        rgba(0,0,0,0.7) 70%,
        rgba(0,0,0,0.95) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* REFLETS SUR L'ÉCRAN - REMIS ET AMÉLIORÉS */
.screen-surface::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 30%;
    height: 25%;
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.6) 0%,
        rgba(255,255,255,0.3) 50%,
        transparent 100%);
    border-radius: 30px;
    transform: rotate(-20deg);
    z-index: 10;
    pointer-events: none;
}

.screen-surface::after {
    content: '';
    position: absolute;
    top: 60%;
    left: 70%;
    width: 25%;
    height: 20%;
    background: linear-gradient(45deg, 
        rgba(255,255,255,0.3) 0%,
        rgba(255,255,255,0.1) 50%,
        transparent 100%);
    border-radius: 20px;
    transform: rotate(30deg);
    z-index: 10;
    pointer-events: none;
}

/* POSITIONNEMENT 3D DES FACES - translateZ = moitié de la taille du cube (220/2 = 110) */
.cube-face.back {
    transform: translateZ(-110px) rotateY(180deg);
}
.cube-face.right {
    transform: rotateY(90deg) translateZ(110px);
}
.cube-face.left {
    transform: rotateY(-90deg) translateZ(110px);
}
.cube-face.top {
    transform: rotateX(90deg) translateZ(110px);
}
.cube-face.bottom {
    transform: rotateX(-90deg) translateZ(110px);
}

/* Couleurs spécifiques pour chaque face selon le thème */
/* Thème noir cathodique */
.game-cube.theme-retro .cube-face.back {
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 4px solid #555;
}
.game-cube.theme-retro .cube-face.right,
.game-cube.theme-retro .cube-face.left {
    background: linear-gradient(145deg, #3a3a3a 0%, #2a2a2a 100%);
    border: 4px solid #555;
}
.game-cube.theme-retro .cube-face.top {
    background: linear-gradient(145deg, #4a4a4a 0%, #3a3a3a 100%);
    border: 4px solid #555;
}
.game-cube.theme-retro .cube-face.bottom {
    background: linear-gradient(145deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 4px solid #555;
}

/* Thème vert foncé */
.game-cube.theme-green .cube-face.back {
    background: linear-gradient(145deg, #1a2e1a 0%, #0a1e0a 100%);
    border: 4px solid #4a6b4a;
}
.game-cube.theme-green .cube-face.right,
.game-cube.theme-green .cube-face.left {
    background: linear-gradient(145deg, #2d4a2d 0%, #1a2e1a 100%);
    border: 4px solid #4a6b4a;
}
.game-cube.theme-green .cube-face.top {
    background: linear-gradient(145deg, #4a6b4a 0%, #2d4a2d 100%);
    border: 4px solid #4a6b4a;
}
.game-cube.theme-green .cube-face.bottom {
    background: linear-gradient(145deg, #0a1e0a 0%, #051005 100%);
    border: 4px solid #4a6b4a;
}

/* Thème violet GameCube */
.game-cube.theme-purple .cube-face.back {
    background: linear-gradient(145deg, #3d2e4d 0%, #2d1e3d 100%);
    border: 4px solid #7d6e95;
}
.game-cube.theme-purple .cube-face.right,
.game-cube.theme-purple .cube-face.left {
    background: linear-gradient(145deg, #5d4e75 0%, #3d2e4d 100%);
    border: 4px solid #7d6e95;
}
.game-cube.theme-purple .cube-face.top {
    background: linear-gradient(145deg, #7d6e95 0%, #5d4e75 100%);
    border: 4px solid #7d6e95;
}
.game-cube.theme-purple .cube-face.bottom {
    background: linear-gradient(145deg, #2d1e3d 0%, #1d0e2d 100%);
    border: 4px solid #7d6e95;
}

/* Thème rouge bordeaux */
.game-cube.theme-burgundy .cube-face.back {
    background: linear-gradient(145deg, #5D0E26 0%, #3D0A1A 100%);
    border: 4px solid #A0435C;
}
.game-cube.theme-burgundy .cube-face.right,
.game-cube.theme-burgundy .cube-face.left {
    background: linear-gradient(145deg, #8B1538 0%, #5D0E26 100%);
    border: 4px solid #A0435C;
}
.game-cube.theme-burgundy .cube-face.top {
    background: linear-gradient(145deg, #B8456B 0%, #8B1538 100%);
    border: 4px solid #A0435C;
}
.game-cube.theme-burgundy .cube-face.bottom {
    background: linear-gradient(145deg, #3D0A1A 0%, #2A0712 100%);
    border: 4px solid #A0435C;
}

/* Thème blanc crème */
.game-cube.theme-cream .cube-face.back {
    background: linear-gradient(145deg, #e8e8e0 0%, #d8d8d0 100%);
    border: 4px solid #fff;
}
.game-cube.theme-cream .cube-face.right,
.game-cube.theme-cream .cube-face.left {
    background: linear-gradient(145deg, #f8f8f0 0%, #e8e8e0 100%);
    border: 4px solid #fff;
}
.game-cube.theme-cream .cube-face.top {
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f0 100%);
    border: 4px solid #fff;
}
.game-cube.theme-cream .cube-face.bottom {
    background: linear-gradient(145deg, #d8d8d0 0%, #c8c8c0 100%);
    border: 4px solid #fff;
}

/* EMBLÈME FALLBACK (cubes sans icône image) */
.emblem-fallback {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}
.emblem-musee {
    font-family: Georgia, 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 5rem;
    color: #d9b46a;
    text-shadow:
        0 0 18px rgba(217, 180, 106, 0.55),
        0 2px 6px rgba(0, 0, 0, 0.55);
}
/* Miniature labyrinthe animé du cube ALGORITHMES (canvas, voir menu.js) */
.algos-maze-thumb {
    width: 200px;
    height: 200px;
    border-radius: 18px;
    display: block;
    position: relative;
    z-index: 10;
    background: #050507;
    box-shadow:
        0 0 22px rgba(0, 229, 255, 0.35),
        inset 0 0 0 1px rgba(0, 229, 255, 0.25);
    transition: transform 0.4s ease;
}
.game-cube:hover .algos-maze-thumb { transform: scale(1.08); }
.emblem-sustainability {
    font-family: 'Space Mono', 'Courier New', monospace;
    font-size: 4.6rem;
    color: #f5e663;
    text-shadow:
        0 0 16px rgba(245, 230, 99, 0.7),
        0 0 4px rgba(245, 230, 99, 0.9);
}

/* ICÔNE DU JEU */
.game-icon {
    width: 200px;
    height: 200px;
    border-radius: 18px;
    object-fit: cover;
    filter: brightness(1.2) contrast(1.2) saturate(1.1);
    transition: transform 0.4s ease;
    z-index: 10;
    position: relative;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.game-cube:hover .game-icon {
    transform: scale(1.08);
    filter: brightness(1.3) contrast(1.3) saturate(1.2);
}

/* FLÈCHES DE NAVIGATION */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(248,248,240,0.9);
    border: 3px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s ease;
    z-index: 100;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    opacity: 0;
}

.nav-arrow.visible {
    opacity: 1;
}

.nav-arrow:hover {
    background: rgba(248,248,240,1);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.nav-arrow.left {
    left: 30px;
}

.nav-arrow.right {
    right: 30px;
}

.nav-arrow::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
}

.nav-arrow.left::before {
    border-width: 12px 18px 12px 0;
    border-color: transparent #333 transparent transparent;
}

.nav-arrow.right::before {
    border-width: 12px 0 12px 18px;
    border-color: transparent transparent transparent #333;
}

/* FENÊTRE DE DESCRIPTION */
.description-popup {
    position: absolute;
    background: rgba(248,248,240,0.98);
    border: 3px solid #fff;
    border-radius: 20px;
    padding: 30px;
    max-width: 550px;
    min-width: 450px;
    box-shadow: 
        0 15px 40px rgba(0,0,0,0.4),
        inset 0 3px 12px rgba(255,255,255,0.8);
    z-index: 1000;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.description-popup.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.popup-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 12px;
}

.popup-subtitle {
    font-size: 17px;
    color: #555;
    margin-bottom: 12px;
    font-style: italic;
}

.popup-description {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
}

.popup-date {
    font-size: 14px;
    color: #888;
    text-align: right;
    margin-top: 15px;
    border-top: 2px solid #eee;
    padding-top: 12px;
    font-weight: bold;
}

/* ====================================
   RESPONSIVE — TABLETTE (≤ 1024px)
   ==================================== */
@media (max-width: 1024px) {
    .cubes-scroll-area {
        padding: 90px 50px;
        /* hauteur dynamique : 2 cubes 200px + gaps 110px + padding */
        height: calc(2 * 200px + 110px + 180px);
    }

    .cube-group {
        grid-auto-columns: 300px;
        gap: 110px 100px;
        /* affiche 3 colonnes confortablement */
        min-width: calc(3 * 300px + 2 * 100px);
    }

    .game-cube,
    .cube-face {
        width: 200px;
        height: 200px;
    }

    /* translateZ = 100px (200/2) */
    .cube-face.back   { transform: translateZ(-100px) rotateY(180deg); }
    .cube-face.right  { transform: rotateY(90deg)  translateZ(100px); }
    .cube-face.left   { transform: rotateY(-90deg) translateZ(100px); }
    .cube-face.top    { transform: rotateX(90deg)  translateZ(100px); }
    .cube-face.bottom { transform: rotateX(-90deg) translateZ(100px); }

    .game-icon { width: 170px; height: 170px; }
}

/* ====================================
   RESPONSIVE — MOBILE (≤ 768px)
   ==================================== */
@media (max-width: 768px) {
    .page-title {
        font-size: 20px;
        padding: 10px 18px;
        top: 16px;
    }
    .page-subtitle { font-size: 13px; }

    .cubes-container { perspective: 1000px; }

    .cubes-scroll-area {
        padding: 80px 32px;
        height: calc(2 * 160px + 80px + 160px);
    }

    .cube-group {
        grid-template-rows: repeat(2, 1fr);
        grid-auto-columns: 240px;
        gap: 80px 60px;
        /* min-width réaliste : 2 colonnes visibles + un peu */
        min-width: calc(2 * 240px + 1 * 60px);
    }

    .game-cube,
    .cube-face {
        width: 160px;
        height: 160px;
    }

    /* translateZ = 80px (160/2) */
    .cube-face.back   { transform: translateZ(-80px) rotateY(180deg); }
    .cube-face.right  { transform: rotateY(90deg)  translateZ(80px); }
    .cube-face.left   { transform: rotateY(-90deg) translateZ(80px); }
    .cube-face.top    { transform: rotateX(90deg)  translateZ(80px); }
    .cube-face.bottom { transform: rotateX(-90deg) translateZ(80px); }

    .game-icon { width: 130px; height: 130px; }

    .nav-arrow {
        width: 44px;
        height: 44px;
    }
    .nav-arrow.left  { left: 12px; }
    .nav-arrow.right { right: 12px; }

    .description-popup {
        max-width: calc(100vw - 32px);
        min-width: 0;
        width: calc(100vw - 32px);
        padding: 20px;
        font-size: 14px;
    }
    .popup-title       { font-size: 17px; margin-bottom: 10px; padding-bottom: 8px; }
    .popup-subtitle    { font-size: 15px; margin-bottom: 8px; }
    .popup-description { font-size: 13px; }
    .popup-date        { font-size: 12px; padding-top: 8px; margin-top: 10px; }
}

/* ====================================
   RESPONSIVE — PETIT MOBILE (≤ 420px)
   ==================================== */
@media (max-width: 420px) {
    .cubes-scroll-area {
        padding: 70px 20px;
        height: calc(2 * 130px + 60px + 140px);
    }

    .cube-group {
        grid-auto-columns: 200px;
        gap: 60px 45px;
        min-width: calc(2 * 200px + 1 * 45px);
    }

    .game-cube,
    .cube-face {
        width: 130px;
        height: 130px;
    }

    .cube-face.back   { transform: translateZ(-65px) rotateY(180deg); }
    .cube-face.right  { transform: rotateY(90deg)  translateZ(65px); }
    .cube-face.left   { transform: rotateY(-90deg) translateZ(65px); }
    .cube-face.top    { transform: rotateX(90deg)  translateZ(65px); }
    .cube-face.bottom { transform: rotateX(-90deg) translateZ(65px); }

    .game-icon { width: 105px; height: 105px; }

    .cube-face.front { border-width: 5px; }

    .page-title { font-size: 17px; padding: 8px 14px; top: 12px; }
    .page-subtitle { font-size: 12px; }
}