/* Effet CRT */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.crt-line {
    position: absolute;
    width: 100%;
    height: 5px;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.8),
        0 0 30px rgba(255, 255, 255, 0.6),
        0 0 45px rgba(255, 255, 255, 0.4);
    animation: scanline 3s linear;
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

/* Effet de grain */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUAAAD8/vz08vT09vT8+vzs7uxH16TeAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAuFJREFUOI0Vk+3NLSEIRG1B8FkJCJ5KQfBZCgQ/S4LgEPD67rA798+ZCR7WNGwDMNNwzDQkGH8C/B/g0hsj7LsynAFqpn0E+ClVf8DoX7ABTH43bdzpYF0ACh4HzEf9R0caQPwLbOBqD9riOacBQkOFZE4TCkLxg4gFGm2QgU2IGHN2J+aEuNYAASwPJGJnSamDZwf2iYiTqhRXEGHVjR+K22YpOlXZvQz2HeW5I7KfAtTZ0zxXC3fMYhvUyXKFWFbEF/2r4pvFAYkBhc1W1Jhy+ZnnOfPbD9RB0oC8eOpeBz8T+eL0B8u3Lt/nwis0j6ScVr5TNy1h5VvB86F8v5JXv5KvF+L5K87PPh8b5c89DjyZNGAAZnm0FN+e8JoNlr/h+M6+faV8S+Yf6X7E0xNZvMVn33WN+l3PB/l4RfwW1q8Ir834vGJ8P+D5B9Z8iu+HLF/H8T0/T/r2npdP3D/j+B+L38H0x+yDnznkx4NlT6ue+5AP63Wd2H8GzD//+v6E2a/sNxq7XxD+g8V/bFj9xTLKh+xiLhS4141lkB+e1a/PrH+7c/wrj/YL6J8a9Eyf4P7KfV0LPB/j9skD09tXHD/nQz21eD7x+Q+Tv+I0w/5/FjvOj9h/0fcHmz/2OPBY/pPpT31ef//m+4fCf13iGfBPJX8E+78Dz/ew2P8P17+Q/Kqu4jcpuj/S/VsO+6HHsSt0PQ+0sgn21/j+JXj/tZn5O5J/4+q/bZ1ekfkvuP406x/fJfdFvRz+gx0fzH1I6AN7f8gEKxCQZmnqFzY9D+Vc1LJlCvUjBZvpuTsL6FUzQPaeJXDZpL+eMatZ9PoQC1tYHXRa6TVZzS6CWpPALHKKlJA3LOQbDYXKwpqTQQOYB6aAiSOA4wB1c1ZmEwJqhMqCeE575cD+nJ1W3ByAoC4/HJmLSqUHK6+8IO7Ho0miHwL8k/H/AJ+D/RsSb5H4AAAAAElFTkSuQmCC');
    mix-blend-mode: screen;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0) scale(1); }
    20% { transform: translate(20%, -15%) scale(1.1); }
    40% { transform: translate(-15%, 25%) scale(0.9); }
    60% { transform: translate(15%, -25%) scale(1.2); }
    80% { transform: translate(-25%, 15%) scale(0.8); }
}

.grain {
    animation: grain 1s steps(4) infinite;
}

/* Intensités du grain très prononcées */
.grain-1 {
    opacity: 0.3;
    background-size: 150px;
}

.grain-2 {
    opacity: 0.5;
    background-size: 130px;
}

.grain-3 {
    opacity: 0.7;
    background-size: 110px;
}

.grain-4 {
    opacity: 0.8;
    background-size: 90px;
}

.grain-5 {
    opacity: 1;
    background-size: 70px;
}/* Effets CRT et Grain */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

@keyframes scanline {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(100vh);
    }
}

.crt-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.3) 50%,
        transparent
    );
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: scanline 3s linear;
}

/* Effet de grain */
.grain {
    position: fixed;
    top: -500%;
    left: -500%;
    right: -500%;
    bottom: -500%;
    width: 1000%;
    height: 1000%;
    pointer-events: none;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)"/></svg>');
    background-size: 200px;
    opacity: 0;
    mix-blend-mode: overlay;
    z-index: 1;
    animation: grain 8s steps(10) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0) }
    10% { transform: translate(-5%, -10%) }
    20% { transform: translate(-15%, 5%) }
    30% { transform: translate(7%, -25%) }
    40% { transform: translate(-5%, 25%) }
    50% { transform: translate(-15%, 10%) }
    60% { transform: translate(15%, 0%) }
    70% { transform: translate(0%, 15%) }
    80% { transform: translate(3%, 35%) }
    90% { transform: translate(-10%, 10%) }
}

/* Niveaux d'intensité du grain */
.grain-1 { opacity: 0.1; }
.grain-2 { opacity: 0.2; }
.grain-3 { opacity: 0.3; }
.grain-4 { opacity: 0.4; }
.grain-5 { opacity: 0.5; }

/* Style du slider */
.slider-container {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.range-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #2196F3;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #1976D2;
}

.slider-value {
    min-width: 24px;
    text-align: center;
    font-weight: bold;
}:root {
    --transition-speed: 0.5s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    overflow: hidden;
}

.main-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background var(--transition-speed) ease;
    overflow: hidden;
}

#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

#particleCanvas.active {
    opacity: 1;
}

#customText {
    font-size: clamp(2rem, 8vw, 6rem);
    text-align: center;
    padding: 2rem;
    transition: all var(--transition-speed) ease;
    user-select: none;
}

/* Bouton de configuration */
.settings-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.settings-button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
}

.settings-button i {
    font-size: 1.5rem;
    color: rgba(0, 0, 0, 0.7);
}

/* Modal de configuration */
.modal {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    transition: all 0.3s ease;
    overflow-y: auto;
    z-index: 999;
}

.modal.active {
    right: 0;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.settings-group {
    margin-bottom: 2rem;
}

.settings-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

/* Text input */
.text-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: #666;
}

/* Presets */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.preset-option {
    aspect-ratio: 2/1;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.preset-option:hover {
    transform: scale(1.05);
}

.preset-option.active {
    outline: 3px solid #000;
}

/* Fonts */
.font-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.font-option {
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f5f5f5;
}

.font-option:hover {
    background: #eee;
}

.font-option.active {
    background: #333;
    color: white;
}

/* Animation switch */
.animation-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Effets CRT et Grain */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: overlay;
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

.crt-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
}

.crt-active .crt-line {
    animation: scanline 8s linear infinite;
}

.grain-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    mix-blend-mode: overlay;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-1%, -1%); }
    20% { transform: translate(1%, 1%); }
    30% { transform: translate(-2%, -2%); }
    40% { transform: translate(2%, 2%); }
    50% { transform: translate(-1%, 1%); }
    60% { transform: translate(1%, -1%); }
    70% { transform: translate(2%, -2%); }
    80% { transform: translate(-2%, 2%); }
    90% { transform: translate(1%, -2%); }
}

/* Slider personnalisé */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.range-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #2196F3;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    min-width: 20px;
    text-align: center;
}

/* Intensités du grain */
.grain-1 { opacity: 0.2; }
.grain-2 { opacity: 0.4; }
.grain-3 { opacity: 0.6; }
.grain-4 { opacity: 0.8; }
.grain-5 { opacity: 1; }
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
        background-size: 200% 200%;
        filter: saturate(0.95);
    }
    25% {
        background-size: 250% 250%;
        filter: saturate(1.05);
    }
    50% {
        background-position: 100% 50%;
        background-size: 200% 200%;
        filter: saturate(1);
    }
    75% {
        background-size: 150% 150%;
        filter: saturate(0.95);
    }
    100% {
        background-position: 0% 50%;
        background-size: 200% 200%;
        filter: saturate(0.95);
    }
}

.animate-gradient {
    position: relative;
    background-size: 200% 200%;
    animation: gradientFlow 20s ease-in-out infinite;
    transition: filter 0.5s ease;
}

.animate-gradient::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: inherit;
    filter: blur(30px);
    opacity: 0.5;
    z-index: -1;
    animation: gradientFlow 15s ease-in-out infinite reverse;
}

/* Animations de la modal */
@keyframes slideIn {
    from {
        right: -400px;
        opacity: 0;
    }
    to {
        right: 0;
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        right: 0;
        opacity: 1;
    }
    to {
        right: -400px;
        opacity: 0;
    }
}

/* Overlay pour la modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 998;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Modal mise à jour */
.modal {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    overflow-y: auto;
    z-index: 999;
    opacity: 0;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.active {
    animation: slideIn 0.3s ease forwards;
    opacity: 1;
}

.modal.closing {
    animation: slideOut 0.3s ease forwards;
}

/* Settings button animation */
.settings-button {
    transition: transform 0.3s ease, background 0.3s ease;
}

.settings-button:hover {
    transform: rotate(90deg) scale(1.1);
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive design */
@media (max-width: 600px) {
    .modal {
        width: 100%;
        right: -100%;
    }

    .preset-grid {
        grid-template-columns: 1fr;
    }

    #customText {
        font-size: clamp(1.5rem, 6vw, 4rem);
        padding: 1rem;
    }
}