:root {
    --bg-app: #050508;
    --bg-panel: rgba(18, 18, 26, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-primary: #7000ff; /* Violet Cyber */
    --accent-secondary: #00f0ff; /* Cyan Néon */
    --text-muted: #888;
    --text-light: #eee;
    --reserved-area: repeating-linear-gradient(45deg, #111, #111 10px, #151515 10px, #151515 20px);
}

* { box-sizing: border-box; outline: none; user-select: none; }

input, textarea, select, [contenteditable="true"] { user-select: text; }

body {
    margin: 0px;
    padding: 0px;
    background-color: var(--bg-app);
    color: var(--text-light);
    font-family: 'Rajdhani', sans-serif;
    height: 100vh;
    overflow: hidden;
}

/* --- SCROLLBAR FUTURISTE --- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: var(--accent-secondary); border-radius: 2px; box-shadow: 0 0 5px var(--accent-secondary); }

/* --- GRID LAYOUT --- */
.app-container {
    display: grid;
    grid-template-columns: 85px 300px 1fr 300px; /* Reserved | Tools | Canvas | Config */
    grid-template-rows: 20px 1fr 180px; /* Reserved | Main | Bottom */
    height: 100vh;
    width: 100vw;
    gap: 4px;
}

/* Zones Réservées */
.reserved-top {
    grid-column: 1 / -1;
    grid-row: 1;
    background: var(--reserved-area);
    border-bottom: 1px dashed #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 0.8rem;
}
.reserved-top::after { content: "ESPACE RÉSERVÉ: BARRE DE MENU"; }

.reserved-left {
    grid-column: 1;
    grid-row: 2 / -1;
    background: var(--reserved-area);
    border-right: 1px dashed #333;
    writing-mode: vertical-rl;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}
.reserved-left::after { content: "ESPACE LATÉRAL"; }

/* --- PANELS COMMUNS --- */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 10px 15px;
    background: linear-gradient(90deg, rgba(112,0,255,0.2), transparent);
    border-bottom: 1px solid var(--accent-primary);
    font-family: 'Orbitron';
    font-size: 0.9rem;
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* --- TOOL PANEL (GAUCHE) --- */
.tools-panel { grid-column: 2; grid-row: 2; }

.tool-group { margin-bottom: 25px; border-left: 2px solid var(--accent-primary); padding-left: 10px; }
.tool-group h4 { margin: 0 0 10px 0; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }

.control-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 0.8rem; }
.control-row input[type=range] { width: 60%; accent-color: var(--accent-secondary); cursor: pointer; }

.file-drop-zone input { display: none; }
.file-drop-zone span {
    display: block; width: 100%; padding: 10px;
    border: 1px dashed var(--accent-secondary);
    text-align: center; cursor: pointer; font-size: 0.8rem;
    transition: 0.3s;
}
.file-drop-zone span:hover { background: rgba(0, 240, 255, 0.1); box-shadow: 0 0 10px rgba(0,240,255,0.2); }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.fx-btn {
    background: #1a1a20; border: 1px solid #333; color: #aaa;
    padding: 5px; font-size: 0.7rem; cursor: pointer;
}
.fx-btn:hover { border-color: var(--accent-secondary); color: white; }

/* --- WORKSPACE (CENTRE) --- */
.workspace {
    grid-column: 3;
    grid-row: 2;
    background: radial-gradient(circle at center, #1a1a24 0%, #000 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workspace-toolbar {
    height: 40px;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #333;
}
.ws-title { font-family: 'Share Tech Mono'; color: var(--accent-secondary); }
.icon-btn { background: none; border: none; color: white; cursor: pointer; margin-left: 10px; }
.icon-btn:hover { color: var(--accent-secondary); }

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    overflow: hidden;
}

/* OBJET PUBLICATION DESIGN */
.futuristic-card {
    width: 320px;
    height: 568px; /* Ratio 9:16 */
    background: #000;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease;
    border: 1px solid #333;
}

.media-layer {
    width: 100%; height: 100%;
    position: relative;
}
.media-layer img, .media-layer video { width: 100%; height: 100%; object-fit: cover; }

/* UI Layer (Simulation de l'affichage final) */
.ui-layer {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 40%);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 20px;
    pointer-events: none; /* Laisse passer les clics vers le média */
}
.ui-top { position: absolute; top: 15px; left: 15px; right: 15px; display: flex; justify-content: space-between; }
.user-badge { background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); padding: 5px 10px; border-radius: 20px; font-size: 0.8rem; border: 1px solid var(--accent-secondary); }
.price-badge { background: var(--accent-primary); padding: 5px 10px; border-radius: 5px; font-weight: bold; }

.ui-content-text h2 { margin: 0; font-size: 1.2rem; font-family: 'Orbitron'; text-shadow: 0 0 10px black; }
.ui-content-text p { font-size: 0.8rem; color: #ccc; margin-top: 5px; line-height: 1.2; }

.ui-controls-right {
    position: absolute; right: 10px; bottom: 80px;
    display: flex; flex-direction: column; gap: 15px;
}
.circle-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}

.ui-bottom-bar { height: 3px; background: #333; margin-top: 15px; border-radius: 2px; }
.progress-fill { width: 30%; height: 100%; background: var(--accent-secondary); box-shadow: 0 0 10px var(--accent-secondary); }

/* --- CONFIG PANEL (DROITE) --- */
.config-panel { grid-column: 4; grid-row: 2; }
.config-group { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #222; }
.config-group h5 { margin: 0 0 10px 0; color: var(--accent-primary); letter-spacing: 1px; }
.up-finance-status {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 214, 92, .45);
    background: rgba(255, 214, 92, .08);
    color: #ffe89a;
    font-size: .76rem;
    line-height: 1.35;
}
.up-finance-status[data-state="ready"] {
    border-color: rgba(82, 255, 154, .5);
    background: rgba(82, 255, 154, .08);
    color: #b8ffd5;
}
.up-finance-status[data-state="blocked"],
.up-finance-status[data-state="error"] {
    border-color: rgba(255, 95, 109, .55);
    background: rgba(255, 95, 109, .08);
    color: #ffb8bf;
}
.up-finance-status + .cyber-btn {
    width: 100%;
    margin: 0 0 10px;
    font-size: .72rem;
}

.cyber-input, .cyber-textarea, .cyber-select {
    width: 100%; background: #0a0a10; border: 1px solid #333;
    color: white; padding: 8px; margin-bottom: 8px; font-family: 'Rajdhani';
    transition: 0.2s;
}
.cyber-input:focus { border-color: var(--accent-secondary); }

.action-zone { display: grid; gap: 10px; margin-top: 20px; }
.cyber-btn {
    padding: 12px; border: none; font-weight: bold; cursor: pointer;
    text-transform: uppercase; letter-spacing: 1px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.2s;
}
.cyber-btn.save { background: #ffd700; color: black; }
.cyber-btn.publish { background: var(--accent-secondary); color: black; box-shadow: 0 0 15px rgba(0, 240, 255, 0.4); }
.cyber-btn.danger { background: #ff0055; color: white; }
.cyber-btn:hover { transform: translateY(-2px); filter: brightness(1.2); }

/* --- BOTTOM PANEL (GESTION) --- */
.bottom-panel { grid-column: 2 / -1; grid-row: 3; }

.tabs { display: flex; gap: 2px; background: #111; }
.tab-btn {
    background: #222; border: none; color: #888; padding: 8px 20px;
    cursor: pointer; font-family: 'Orbitron'; font-size: 0.8rem;
}
.tab-btn.active { background: var(--accent-primary); color: white; }

.gallery-track {
    display: flex; gap: 15px; padding: 15px; overflow-x: auto; height: 100%;
    align-items: center;
}
.gallery-item {
    min-width: 100px; height: 100px; background: #222;
    border: 1px solid #444; border-radius: 8px; cursor: pointer;
    position: relative; overflow: hidden; transition: 0.2s;
}
.gallery-item:hover { border-color: var(--accent-secondary); transform: scale(1.05); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; }
.gallery-item .status {
    position: absolute; bottom: 0; left: 0; width: 100%;
    font-size: 0.7rem; text-align: center; color: black; font-weight: bold;
}
.status.pub { background: var(--accent-secondary); }
.status.draft { background: #ffd700; }

/* ANIMATIONS CLASSES */
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes shake { 0% { transform: translate(1px, 1px) rotate(0deg); } 10% { transform: translate(-1px, -2px) rotate(-1deg); } 20% { transform: translate(-3px, 0px) rotate(1deg); } 30% { transform: translate(3px, 2px) rotate(0deg); } 100% { transform: translate(1px, -2px) rotate(-1deg); } }
@keyframes glitch { 0% { clip-path: inset(50% 0 30% 0); transform: translate(-5px,0); } 20% { clip-path: inset(10% 0 60% 0); transform: translate(5px,0); } 40% { clip-path: inset(80% 0 5% 0); transform: translate(-5px,0); } 60% { clip-path: inset(15% 0 40% 0); transform: translate(5px,0); } 100% { clip-path: inset(50% 0 30% 0); transform: translate(0,0); } }

.anim-pulse #active-image { animation: pulse 2s infinite; }
.anim-shake #active-image { animation: shake 0.5s infinite; }
.anim-glitch #active-image { animation: glitch 0.3s infinite; filter: hue-rotate(90deg); }

.hidden { display: none !important; }
.hidden-smooth { opacity: 0; height: 0; overflow: hidden; transition: 0.3s; }
.visible-smooth { opacity: 1; height: auto; }

/* --- PATCH CSS START --- */

/* 1. GRILLE DES FORMES */
.shape-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.shape-btn {
    background: #111;
    border: 1px solid #333;
    color: var(--accent-secondary);
    padding: 10px;
    cursor: pointer;
    transition: 0.3s;
}
.shape-btn:hover { background: var(--accent-secondary); color: black; }

/* 2. CLASSES DE FORMES (CLIP-PATHS) */
.clip-shape-none { clip-path: none; border-radius: 0; }
.clip-shape-circle { clip-path: circle(50% at 50% 50%); }
.clip-shape-hexagon { clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); }
.clip-shape-diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.clip-shape-shield { clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.clip-shape-cyber-cut { clip-path: polygon(0 0, 80% 0, 100% 20%, 100% 100%, 20% 100%, 0 80%); }

/* Application de la forme sur le media layer */
.media-layer { transition: clip-path 0.5s ease; }


/* 3. STUDIO AUDIO UI */
#audio-visualizer {
    background: #000;
    border: 1px solid #333;
    width: 100%;
    border-radius: 4px;
    margin-bottom: 10px;
}

.mixer-controls {
    display: flex;
    justify-content: space-around;
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.fader-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.fader-group label { font-size: 0.7rem; color: #aaa; }

/* Fader Vertical (Technique Cross-browser) */
input[type=range].vertical-fader {
    writing-mode: bt-lr; /* IE/Edge */
    -webkit-appearance: slider-vertical; /* Webkit */
    width: 8px;
    height: 80px;
    padding: 0 5px;
}

.fx-mini-btn {
    background: #222; border: 1px solid var(--accent-primary);
    color: #fff; font-size: 0.7rem; padding: 4px; cursor: pointer;
}
.fx-mini-btn:active { background: var(--accent-primary); }

.audio-actions { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.record-btn { background: #cc0000; color: white; border:none; padding:8px; cursor:pointer; }
.record-btn.recording { animation: pulse-red 1s infinite; }
.file-mini-upload {
    font-size: 0.8rem; text-align: center; cursor: pointer; color: var(--accent-secondary);
    border: 1px dashed #444; padding: 5px; display: block;
}
.file-mini-upload input { display: none; }

/* 4. BOUTONS SMART AI */
.smart-controls { display: grid; gap: 5px; }
.cyber-toggle {
    background: transparent; border: 1px solid var(--accent-secondary);
    color: var(--text-light); padding: 8px; cursor: pointer;
    text-align: left; font-size: 0.8rem; display: flex; align-items: center; gap: 10px;
}
.cyber-toggle:hover, .cyber-toggle.active {
    background: rgba(0, 240, 255, 0.15);
    border-left: 4px solid var(--accent-secondary);
}

@keyframes pulse-red { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
/* --- PATCH CSS END --- */





/* --- PATCH ZOOM & SCROLL START --- */

/* 1. Zone de Scroll (Le cadre parent) */
.canvas-scroll-area {
    flex: 1;
    overflow: auto; /* Active les barres de défilement si nécessaire */
    background: radial-gradient(circle at center, #1a1a24 0%, #000 100%);
    position: relative;
    display: grid;
    place-items: center; /* Centre le contenu si plus petit que l'écran */
    padding: 50px; /* Marge interne pour ne pas coller aux bords */
}

/* 2. Wrapper de Zoom (L'élément qui subit la transformation scale) */
.canvas-zoom-wrapper {
    transform-origin: center center;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Pas de taille fixe, s'adapte au contenu (.futuristic-card) */
}

/* 3. Contrôles de Zoom dans la Toolbar */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.4);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid #333;
}

#zoom-slider {
    width: 100px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    appearance: none;
    outline: none;
}

#zoom-slider::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-secondary);
    cursor: pointer;
    box-shadow: 0 0 5px var(--accent-secondary);
}

#zoom-value {
    font-family: 'Share Tech Mono';
    font-size: 0.8rem;
    color: var(--accent-secondary);
    min-width: 40px;
    text-align: center;
}

.icon-btn.small {
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #222;
}
.icon-btn.small:hover { background: var(--accent-secondary); color: black; }

/* Custom Scrollbars pour la zone canvas (plus visible que les globales) */
.canvas-scroll-area::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.canvas-scroll-area::-webkit-scrollbar-track {
    background: #050505;
}
.canvas-scroll-area::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}
.canvas-scroll-area::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* --- PATCH ZOOM & SCROLL END --- */

/* --- PATCH PAYWALL START --- */

/* État verrouillé du média */
.media-locked {
    filter: blur(15px) grayscale(0.5) !important;
    transform: scale(1.05); /* Évite les bords blancs dus au flou */
    pointer-events: none;
}

.paywall-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.5s ease;
}

.paywall-content {
    text-align: center;
    color: white;
    font-family: 'Orbitron';
}

.paywall-content i {
    font-size: 3rem;
    color: var(--accent-secondary);
    margin-bottom: 15px;
    text-shadow: 0 0 15px var(--accent-secondary);
}

.unlock-btn {
    background: var(--accent-secondary);
    border: none;
    padding: 10px 20px;
    font-weight: bold;
    cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
    transition: 0.3s;
}

.unlock-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--accent-secondary);
}

/* Animation de transition HD */
.hd-reveal {
    animation: reveal-hd 1.2s forwards;
}

@keyframes reveal-hd {
    0% { filter: blur(15px); }
    100% { filter: blur(0px) brightness(1.1); }
}

/* --- PATCH PAYWALL END --- */

/* --- PATCH VISIBILITÉ TEXTE START --- */

/* On s'assure que l'UI est toujours au-dessus de tout, même du cadenas */
.ui-layer {
    z-index: 20 !important; /* Supérieur au paywall-overlay qui est à 10 */
    pointer-events: none; /* Laisse passer les clics vers le bouton déverrouiller si besoin */
}

/* On s'assure que les textes sont bien lisibles sur le flou */
.ui-content-text h2, .ui-content-text p {
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 1); /* Ombre portée forte pour la lisibilité */
    opacity: 1 !important;
    visibility: visible !important;
}

/* On force la visibilité même si un parent est caché */
.ui-layer * {
    pointer-events: auto; /* Permet de cliquer sur les icônes si besoin */
}

/* --- PATCH VISIBILITÉ TEXTE END --- */

/* --- PATCH 2 : ESPACES RÉSERVÉS TRANSPARENTS START --- */

/* 1. Rendre les conteneurs transparents et sans bordure */
.reserved-top,
.reserved-left {
    background: transparent !important; /* Supprime le motif rayé */
    border: none !important; /* Supprime les bordures en pointillés */
    box-shadow: none !important;
    color: transparent !important; /* Cache le texte s'il y en a */
}

/* 2. Supprimer les textes générés automatiquement (les placeholders) */
.reserved-top::after,
.reserved-left::after {
    content: none !important; /* Supprime le contenu textuel */
    display: none !important; /* Masque l'élément généré */
}

/* --- PATCH 2 END --- */

/* --- CORRECTIF DÉCALAGE IMAGE PREVIEW --- */

/* 1. Verrouillage du conteneur parent */
.futuristic-card {
    /* On s'assure que le conteneur est une référence de positionnement */
    position: relative !important; 
    padding: 0 !important;
    border: none !important; /* Optionnel: supprime la bordure si elle crée un décalage interne */
    /* Le border-radius doit couper tout ce qui dépasse */
    overflow: hidden !important; 
    /* Fix pour Safari/Chrome pour que le border-radius coupe bien l'image transformée */
    transform: translateZ(0); 
}

/* 2. Le calque média doit être une ancre absolue */
.media-layer {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    z-index: 1; /* S'assure qu'il est au fond */
}

/* 3. L'image/vidéo forcée à remplir tout l'espace */
.media-layer img, 
.media-layer video {
    position: absolute !important; /* Force le collage aux bords */
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Remplissage par recadrage intelligent */
    object-position: center center; /* Centre l'image */
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    /* Important pour éviter que les filtres ou transforms ne créent des bords flous */
    transform-origin: center center;
}

/* 4. Gestion spécifique pour les formes géométriques (clip-path) */
/* Quand une forme est appliquée, on s'assure qu'elle coupe bien le calque média */
[class*="clip-shape-"] {
    /* Le clip-path s'applique au conteneur, l'image suit */
    overflow: visible !important; /* Parfois nécessaire pour que le clip-path fonctionne bien sans double coupure */
}
 /* --- PATCH 1 : MEDIA FULL BLEED (Remplissage total) START --- */

/* 1. On s'assure que le conteneur principal de la carte n'a pas de marge interne */
.futuristic-card {
    padding: 0 !important;
    /* Optionnel : décommentez la ligne suivante si vous voulez aussi supprimer la bordure fine */
    /* border: none !important; */
}

/* 2. On force le calque média à prendre 100% de l'espace disponible */
.media-layer {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    /* S'assure que le border-radius de la carte coupe bien l'image dans les coins */
    overflow: hidden; 
}

/* 3. On force l'image ou la vidéo à couvrir toute la zone sans déformation (crop) */
.media-layer img, 
.media-layer video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* C'est la clé pour le remplissage total */
    display: block; /* Évite les petits espaces fantômes sous les images */
}

/* --- PATCH 1 END --- */
/* --- PATCH FINAL : ALIGNEMENT ABSOLU --- */

/* 1. On neutralise toute influence du parent */
#preview-card {
    position: relative !important;
    overflow: hidden !important;
    display: block !important;
    padding: 0 !important;
}

/* 2. Le media-layer devient un cadre rigide invisible */
#media-layer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 3. L'image est étirée pour remplir, puis recadrée par object-fit */
#active-image, #active-video {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 100.2% !important; /* 0.2% de sécurité pour éviter les fuites de pixels sur les bords */
    height: 100.2% !important;
    transform: translate(-50%, -50%) !important; /* Centrage mathématique parfait */
    object-fit: cover !important; 
    object-position: center !important;
    min-width: 100% !important;
    min-height: 100% !important;
    border: none !important;
    outline: none !important;
}

/* 4. On force la suppression des arrondis internes qui pourraient simuler un décalage */
#media-layer * {
    border-radius: 0 !important;
}



.ui-layer .circle-btn {
  pointer-events:auto;
}

.ui-layer {
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  pointer-events:none;
  padding:20px;
}
.ui-layer {
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  pointer-events:none;
  padding:20px;
}

.ui-top {
  display:flex;
  justify-content:center;
  align-items:center;
}

.price-badge {
  position:absolute;
  top:15px;
  left:50%;
  transform:translateX(-50%);
  background:#00eaff;
  color:#000;
  padding:6px 14px;
  border-radius:20px;
  font-weight:bold;
}

.ui-content-text {
  position:absolute;
  top:60px;
  left:20px;
}

.ui-description {
  position:absolute;
  bottom:30px;
  left:20px;
  right:20px;
}

.preview-blur {
  
  filter: blur(15px) grayscale(0.5) !important;
    transform: scale(1.05); /* Évite les bords blancs dus au flou */
    pointer-events: none;
}

.ui-controls-left {
  position:absolute;
  left:20px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  flex-direction:column;
  gap:15px;
  pointer-events:auto;
}

/* Conteneur de l'overlay (Arrière-plan flouté) */
.studio-lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.85); /* Sombre profond */
    backdrop-filter: blur(12px); /* Effet de verre dépoli */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* La boîte centrale (Interface Holographique) */
.studio-lock-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 242, 0.3); /* Bordure turquoise futuriste */
    box-shadow: 0 0 40px rgba(0, 255, 242, 0.1), inset 0 0 20px rgba(0, 255, 242, 0.05);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: fadeIn ScaleUp 0.5s ease-out;
}

/* Titre avec effet de lueur */
.studio-lock-box h2 {
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0, 255, 242, 0.6);
}

/* Texte descriptif */
.studio-lock-box p {
    color: #a0aec0;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Pièces jointes de publication */
.publication-attachment-box {
    display: grid;
    gap: 8px;
    margin: 4px 0 20px;
    padding: 10px;
    border: 1px solid rgba(0, 240, 255, .22);
    border-radius: 8px;
    background: rgba(0, 240, 255, .035);
}
.publication-attachment-box h6 { margin: 0; color: var(--accent-secondary); font-size: .82rem; letter-spacing: .5px; }
.publication-attachment-box .file-mini-upload { margin: 0; }
.attachment-download-toggle { justify-content: flex-start; gap: 8px; margin: 0; font-size: .78rem; }
.publication-attachment-status { color: var(--text-muted); line-height: 1.3; overflow-wrap: anywhere; }
.publication-attachment-status[data-tone="pending"] { color: #ffd866; }
.publication-attachment-status[data-tone="success"] { color: #65ffb1; }
.publication-attachment-status[data-tone="error"] { color: #ff829a; }

/* Extrait video court visible dans les objets/cards de pub.html */
.publication-video-preview-tool {
    border-color: rgba(0, 255, 198, .24);
    background:
        radial-gradient(circle at 18% 0%, rgba(0, 255, 198, .1), transparent 34%),
        rgba(0, 240, 255, .035);
}
.publication-video-preview-tool[data-video-preview-ready="0"] {
    opacity: .78;
}
.publication-video-preview-tool h4 {
    color: #7dffd9;
}
.video-preview-auto-toggle {
    justify-content: flex-start;
    gap: 8px;
    margin: 0 0 8px;
    font-size: .78rem;
}
.video-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}
.video-preview-grid label {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.video-preview-grid input {
    width: 100%;
    min-width: 0;
}
.video-preview-status {
    display: block;
    color: var(--text-muted);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.video-preview-status[data-tone="success"] { color: #65ffb1; }
.video-preview-status[data-tone="pending"] { color: #ffd866; }
.video-preview-status[data-tone="error"] { color: #ff829a; }

/* Le studio conserve ses marges lisibles sur desktop et devient réellement
   défilable sur téléphone au lieu de compresser quatre colonnes illisibles. */
@media (max-width: 900px) {
    body { height: auto; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
    .app-container { display: flex; flex-direction: column; width: 100%; min-height: 100dvh; height: auto; gap: 8px; padding: 0 10px 12px; overflow: visible; }
    .reserved-top, .reserved-left { display: none; }
    .tools-panel, .workspace, .config-panel, .bottom-panel { width: 100%; min-width: 0; }
    .tools-panel { min-height: 320px; max-height: 48dvh; }
    .workspace { min-height: 620px; }
    .config-panel { min-height: 560px; max-height: none; }
    .bottom-panel { min-height: 190px; }
    .workspace-toolbar { min-height: 44px; height: auto; flex-wrap: wrap; gap: 6px; padding: 7px 10px; }
    .zoom-controls { order: 3; width: 100%; justify-content: center; }
    .canvas-scroll-area { padding: 24px 12px; min-height: 560px; }
    .futuristic-card { width: min(320px, calc(100vw - 64px)); height: min(568px, calc((100vw - 64px) * 1.775)); }
    .scroll-wrapper { padding: 12px; }
    .tabs { overflow-x: auto; white-space: nowrap; }
    .tab-btn { flex: 0 0 auto; padding-inline: 12px; }
}

@media (min-width: 901px) and (max-width: 1240px) {
    .app-container { grid-template-columns: 68px minmax(220px, 24vw) minmax(0, 1fr) minmax(240px, 26vw); }
    .scroll-wrapper { padding: 12px; }
}

/* Le panneau central reste visuellement centre malgre la reserve gauche de la grille. */
@media (min-width: 1241px) {
    .workspace .canvas-container {
        transform: none;
    }
    .workspace .workspace-toolbar {
        padding-left: 20px;
    }
}

/* Prévention du double défilement et du flash du haut de page.
   Le studio desktop possède une seule hauteur utile ; sur mobile, le document
   devient l'unique défilement principal et les panneaux restent contenus. */
html.unipay-publication-prepaint body.unipay-publication-shell,
body.unipay-publication-shell {
    overflow-x: hidden;
}
@media (min-width: 901px) {
    body.unipay-publication-shell {
        height: 100dvh !important;
        overflow-y: hidden !important;
    }
    body.unipay-publication-shell > .page-scope,
    body.unipay-publication-shell > .page-scope > div:not(.fut-sidebar),
    body.unipay-publication-shell main {
        min-height: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
    }
    body.unipay-publication-shell main {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    body.unipay-publication-shell .app-container {
        height: calc(100dvh - var(--fut-menu-height, 72px) - 8px) !important;
        min-height: 0 !important;
        max-height: calc(100dvh - var(--fut-menu-height, 72px) - 8px) !important;
    }
}
@media (max-width: 900px) {
    body.unipay-publication-shell {
        height: auto !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
    }
    body.unipay-publication-shell main {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        min-height: 0 !important;
    }
}

/* Bouton Interactif (Style High-Tech) */
#go-login {
    background: transparent;
    color: #00fff2;
    border: 2px solid #00fff2;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 242, 0.2);
}

#go-login:hover {
    background: #00fff2;
    color: #030712;
    box-shadow: 0 0 30px rgba(0, 255, 242, 0.8);
    transform: translateY(-2px);
}

#go-login:active {
    transform: translateY(0);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ScaleUp {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

/* Mobile hard guard: the studio must never keep the desktop 4-column grid on
   phones. The body becomes the only main scroller and every panel stays inside
   the active viewport width. */
@media (max-width: 900px) {
    html.unipay-page-publication,
    html.unipay-orientation-ready.unipay-page-publication,
    body.unipay-publication-shell {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    body.unipay-publication-shell {
        height: auto !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
        padding: 0 !important;
    }

    body.unipay-publication-shell .app-container {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 100dvh !important;
        margin: 0 !important;
        padding: calc(var(--fut-menu-height, 74px) + 8px) 10px calc(var(--unipay-bottombar-measured, 76px) + 18px) !important;
        gap: 10px !important;
        overflow: visible !important;
        transform: none !important;
    }

    body.unipay-publication-shell .reserved-top,
    body.unipay-publication-shell .reserved-left {
        display: none !important;
    }

    body.unipay-publication-shell .tools-panel,
    body.unipay-publication-shell .workspace,
    body.unipay-publication-shell .config-panel,
    body.unipay-publication-shell .bottom-panel {
        position: relative !important;
        flex: 0 0 auto !important;
        width: min(100%, calc(100vw - 20px)) !important;
        max-width: calc(100vw - 20px) !important;
        min-width: 0 !important;
        height: auto !important;
        max-height: none !important;
        margin-inline: auto !important;
        overflow: visible !important;
        transform: none !important;
    }

    body.unipay-publication-shell .glass-panel,
    body.unipay-publication-shell .scroll-wrapper,
    body.unipay-publication-shell .tool-group,
    body.unipay-publication-shell .config-group,
    body.unipay-publication-shell .publication-attachment-box,
    body.unipay-publication-shell .publication-video-preview-tool {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-wrap: anywhere !important;
    }

    body.unipay-publication-shell .scroll-wrapper {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 12px !important;
    }

    body.unipay-publication-shell .workspace {
        min-height: 620px !important;
        overflow: hidden !important;
    }

    body.unipay-publication-shell .workspace-toolbar {
        height: auto !important;
        min-height: 46px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 8px !important;
    }

    body.unipay-publication-shell .ws-title,
    body.unipay-publication-shell .zoom-controls,
    body.unipay-publication-shell .ws-actions {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    body.unipay-publication-shell .zoom-controls {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    body.unipay-publication-shell .canvas-scroll-area {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 560px !important;
        padding: 18px 8px !important;
        overflow: hidden !important;
    }

    body.unipay-publication-shell .canvas-zoom-wrapper,
    body.unipay-publication-shell #zoom-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        display: grid !important;
        place-items: center !important;
        transform-origin: top center !important;
    }

    body.unipay-publication-shell .futuristic-card,
    body.unipay-publication-shell #preview-card.futuristic-card {
        width: min(320px, calc(100vw - 74px)) !important;
        min-width: min(320px, calc(100vw - 74px)) !important;
        height: min(568px, calc((100vw - 74px) * 1.775)) !important;
        min-height: min(568px, calc((100vw - 74px) * 1.775)) !important;
        margin-inline: auto !important;
    }

    body.unipay-publication-shell .control-row,
    body.unipay-publication-shell .video-preview-grid,
    body.unipay-publication-shell .mixer-controls,
    body.unipay-publication-shell .fx-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
    }

    body.unipay-publication-shell input,
    body.unipay-publication-shell textarea,
    body.unipay-publication-shell select,
    body.unipay-publication-shell button,
    body.unipay-publication-shell .cyber-input,
    body.unipay-publication-shell .cyber-textarea,
    body.unipay-publication-shell .cyber-select,
    body.unipay-publication-shell .full-width-btn {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    body.unipay-publication-shell input[type="range"] {
        width: 100% !important;
    }
}

/* 20260823 — Studio mobile : le document garde sa navigation verticale,
   mais aucun panneau ne dilate le flux avec la totalité de son contenu.
   Outils, diffusion, aperçu et galerie possèdent chacun leur zone de
   défilement; les règles desktop restent inchangées. */
@media (max-width: 900px) {
    body.unipay-publication-shell .tools-panel,
    body.unipay-publication-shell .config-panel,
    body.unipay-publication-shell .bottom-panel {
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    body.unipay-publication-shell .tools-panel,
    body.unipay-publication-shell .config-panel {
        flex: 0 0 clamp(280px, 44dvh, 390px) !important;
        height: clamp(280px, 44dvh, 390px) !important;
        max-height: clamp(280px, 44dvh, 390px) !important;
    }

    body.unipay-publication-shell .tools-panel .scroll-wrapper,
    body.unipay-publication-shell .config-panel .scroll-wrapper {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        touch-action: pan-y !important;
        -webkit-overflow-scrolling: touch;
    }

    body.unipay-publication-shell .workspace {
        flex: 0 0 clamp(430px, 60dvh, 560px) !important;
        height: clamp(430px, 60dvh, 560px) !important;
        min-height: 0 !important;
        max-height: clamp(430px, 60dvh, 560px) !important;
        overflow: hidden !important;
    }

    body.unipay-publication-shell .workspace-toolbar {
        flex: 0 0 auto !important;
    }

    body.unipay-publication-shell .canvas-scroll-area {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: auto !important;
        overscroll-behavior: contain !important;
        touch-action: pan-x pan-y pinch-zoom !important;
        -webkit-overflow-scrolling: touch;
    }

    body.unipay-publication-shell .bottom-panel {
        flex: 0 0 clamp(150px, 29dvh, 250px) !important;
        height: clamp(150px, 29dvh, 250px) !important;
        max-height: clamp(150px, 29dvh, 250px) !important;
    }

    body.unipay-publication-shell .bottom-panel .gallery-track {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}
/* Creator Studio production rail — the browser preview and the official
   server master are deliberately represented as two different authorities. */
.studio-production-rail {
    width: min(1540px, calc(100% - 32px));
    margin: 16px auto 12px;
    padding: 16px 18px;
    border: 1px solid rgba(0, 229, 255, .28);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(4, 18, 34, .9), rgba(9, 25, 47, .64));
    box-shadow: 0 18px 55px rgba(0, 0, 0, .26), inset 0 1px rgba(255, 255, 255, .05);
    backdrop-filter: blur(18px);
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(560px, 1.5fr);
    gap: 22px;
    align-items: center;
}
.studio-production-rail h2 { margin: 2px 0 6px; color: #eefcff; font-size: clamp(1rem, 1.5vw, 1.35rem); }
.studio-production-rail p { margin: 0; color: #adc5d8; line-height: 1.55; font-size: .82rem; }
.studio-production-rail .studio-production-kicker { color: #56f3db; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; font-size: .67rem; }
.studio-production-rail ol { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(70px, 1fr)); gap: 7px; margin: 0; padding: 0; }
.studio-production-rail li { min-height: 58px; border: 1px solid rgba(151, 183, 207, .18); border-radius: 12px; color: #93aabc; background: rgba(2, 10, 22, .45); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; text-align: center; font-size: .68rem; transition: border-color .2s ease, background .2s ease, color .2s ease; }
.studio-production-rail li span { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: rgba(133, 167, 193, .14); font-weight: 800; }
.studio-production-rail li.is-active { color: #eaffff; border-color: rgba(0, 229, 255, .65); background: rgba(0, 229, 255, .12); box-shadow: inset 0 0 20px rgba(0, 229, 255, .08); }
.studio-production-rail li.is-complete { color: #75ffe0; border-color: rgba(64, 255, 184, .42); background: rgba(30, 198, 145, .1); }
#render-job-status[data-state="failed"], #render-job-status[data-state="error"] { color: #ff91a9 !important; }
#render-job-status[data-state="processing"], #render-job-status[data-state="queued"], #render-job-status[data-state="retrying"] { color: #ffd66b !important; }
#render-job-status[data-state="ready"] { color: #75ffe0 !important; }
#studio-publish-button:disabled { opacity: .44; filter: grayscale(.45); cursor: not-allowed; box-shadow: none; }
#studio-schedule-button:disabled { opacity: .44; filter: grayscale(.45); cursor: not-allowed; }
.studio-lifecycle-note { margin: 8px 0 0; color: var(--text-muted, #9fb0ca); font-size: .72rem; line-height: 1.5; }
.studio-autosave-status { display:block; color:#a9c7d8; font-size:.7rem; line-height:1.45; text-align:center; }
.studio-autosave-status[data-state="pending"] { color:#ffd66b; }
.studio-autosave-status[data-state="saved"] { color:#75ffe0; }
.studio-autosave-status[data-state="error"] { color:#ff91a9; }
.gallery-item .gallery-meta { position:absolute; inset:auto 0 0; z-index:2; padding:20px 7px 7px; background:linear-gradient(transparent,rgba(0,0,0,.9)); }
.gallery-item .gallery-meta h4 { margin:0; overflow:hidden; color:#fff; font-size:.67rem; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.gallery-item .gallery-meta span { color:#8fffee; font-size:.58rem; }
.gallery-item .gallery-delete-button { position:absolute; z-index:4; top:6px; right:6px; width:29px; height:29px; display:grid; place-items:center; border:1px solid rgba(255,80,120,.7); border-radius:9px; background:rgba(34,3,15,.86); color:#ff91a9; cursor:pointer; box-shadow:0 4px 14px rgba(0,0,0,.35); }
.gallery-item .gallery-delete-button:hover,.gallery-item .gallery-delete-button:focus-visible { color:#fff; border-color:#ff3f75; background:rgba(170,12,55,.9); outline:none; }
.studio-mobile-steps { display: none; }

@media (max-width: 980px) {
    .studio-production-rail { grid-template-columns: 1fr; width: calc(100% - 20px); padding: 14px; }
    .studio-production-rail ol { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 5px; }
    .studio-production-rail li { min-width: 105px; scroll-snap-align: start; }
}

@media (max-width: 620px) {
    .studio-production-rail { margin-top: 8px; border-radius: 14px; }
    .studio-production-rail p { font-size: .78rem; }
    .studio-mobile-steps { width: calc(100% - 20px); margin: 0 auto 10px; display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 0 7px; }
    .studio-mobile-steps button { flex: 0 0 145px; min-height: 48px; scroll-snap-align: start; border: 1px solid rgba(0, 229, 255, .3); border-radius: 12px; color: #dffcff; background: rgba(5, 24, 43, .82); display: flex; align-items: center; gap: 7px; justify-content: center; font-size: .73rem; }
    .studio-mobile-steps span { width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 229, 255, .15); color: #63ffe5; font-weight: 800; }
}
