* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #0a0a12;
    color: #e0e0ff;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(20, 0, 80, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 80, 120, 0.3) 0%, transparent 40%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #00ffaa;
    text-shadow: 0 0 15px rgba(0, 255, 170, 0.6);
    position: relative;
    overflow: hidden;
}

.glitch-title {
    position: relative;
    display: inline-block;
}

.glitch-title::before,
.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip: rect(0, 0, 0, 0);
}

.glitch-title::before {
    left: 2px;
    text-shadow: -2px 0 #ff00aa;
    animation: glitch-title-animation 2s infinite linear alternate-reverse;
}

.glitch-title::after {
    left: -2px;
    text-shadow: 2px 0 #00ffff;
    animation: glitch-title-animation 3s infinite linear alternate-reverse;
}

@keyframes glitch-title-animation {
    0% {
        clip: rect(44px, 9999px, 56px, 0);
    }
    5% {
        clip: rect(20px, 9999px, 87px, 0);
    }
    10% {
        clip: rect(67px, 9999px, 34px, 0);
    }
    15% {
        clip: rect(95px, 9999px, 12px, 0);
    }
    20% {
        clip: rect(33px, 9999px, 75px, 0);
    }
    25% {
        clip: rect(18px, 9999px, 49px, 0);
    }
    30% {
        clip: rect(76px, 9999px, 27px, 0);
    }
    35% {
        clip: rect(81px, 9999px, 62px, 0);
    }
    40% {
        clip: rect(9px, 9999px, 93px, 0);
    }
    45% {
        clip: rect(51px, 9999px, 21px, 0);
    }
    50% {
        clip: rect(39px, 9999px, 80px, 0);
    }
    55% {
        clip: rect(24px, 9999px, 56px, 0);
    }
    60% {
        clip: rect(67px, 9999px, 19px, 0);
    }
    65% {
        clip: rect(86px, 9999px, 38px, 0);
    }
    70% {
        clip: rect(48px, 9999px, 72px, 0);
    }
    75% {
        clip: rect(15px, 9999px, 31px, 0);
    }
    80% {
        clip: rect(90px, 9999px, 54px, 0);
    }
    85% {
        clip: rect(29px, 9999px, 65px, 0);
    }
    90% {
        clip: rect(73px, 9999px, 8px, 0);
    }
    95% {
        clip: rect(42px, 9999px, 95px, 0);
    }
    100% {
        clip: rect(36px, 9999px, 27px, 0);
    }
}

.upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background-color: rgba(25, 25, 40, 0.6);
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 170, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.upload-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(0, 255, 170, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: lightSweep 6s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes lightSweep {
    0% {
        transform: translate(-100%, -100%) rotate(45deg);
    }
    100% {
        transform: translate(100%, 100%) rotate(45deg);
    }
}

.upload-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(90deg, #00ffaa, #00ccff);
    color: #000;
    font-weight: bold;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    border: none;
    z-index: 2;
}

.upload-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
    transition: all 0.3s ease;
    opacity: 0;
}

.upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 255, 170, 0.7);
}

.upload-button:hover::after {
    opacity: 1;
    left: -10%;
}

#imageUpload {
    display: none;
}

.or {
    margin: 1.5rem 0;
    color: #8888bb;
    position: relative;
    z-index: 2;
}

.or::before, .or::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 50px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8888bb, transparent);
}

.or::before {
    left: -60px;
}

.or::after {
    right: -60px;
}

#useSampleBtn {
    background: transparent;
    color: #00ffaa;
    border: 1px solid #00ffaa;
    padding: 0.75rem 1.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

#useSampleBtn:hover {
    background-color: rgba(0, 255, 170, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 170, 0.3);
}

.editor-container {
    display: none;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    background-color: rgba(25, 25, 40, 0.6);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 170, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.editor-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(90deg, transparent 95%, rgba(0, 255, 170, 0.5) 100%),
        linear-gradient(180deg, transparent 95%, rgba(0, 255, 170, 0.5) 100%);
    background-size: 20px 20px;
    opacity: 0.1;
    pointer-events: none;
}

.image-preview-container {
    background-color: rgba(15, 15, 25, 0.8);
    border-radius: 0.25rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    height: 600px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    box-shadow: inset 0 0 30px rgba(0, 255, 255, 0.1);
    position: relative;
}

.image-preview-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.5), transparent);
    animation: scanline 3s linear infinite;
    opacity: 0.3;
}

@keyframes scanline {
    0% {
        top: 0;
    }
    100% {
        top: 100%;
    }
}

#imageContainer {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 1px solid rgba(0, 255, 255, 0.05);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.controls-container {
    background-color: rgba(15, 15, 25, 0.8);
    border-radius: 0.25rem;
    padding: 1.5rem;
    border: 1px solid rgba(0, 255, 255, 0.2);
    position: relative;
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 170, 0.5) rgba(15, 15, 25, 0.8);
}

.controls-container::-webkit-scrollbar {
    width: 8px;
}

.controls-container::-webkit-scrollbar-track {
    background: rgba(15, 15, 25, 0.8);
}

.controls-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 255, 170, 0.3);
    border-radius: 4px;
}

.controls-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 255, 170, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: #00ffaa;
    border-bottom: 1px solid rgba(0, 255, 170, 0.3);
    padding-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(0, 255, 170, 0.3);
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, rgba(0, 255, 170, 0.8), transparent);
}

.control-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
}

.control-group:hover {
    transform: translateX(5px);
}

.control-group label {
    margin-bottom: 0.5rem;
    color: #00ccff;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Add styles for the new extreme glitch effects section */
.control-group label[for="realityDistortionToggle"],
.control-group label[for="quantumFragmentationToggle"],
.control-group label[for="dimensionSpliceToggle"],
.control-group label[for="timeEchoToggle"],
.control-group label[for="realityBreachToggle"] {
    color: #ff00aa;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 0, 170, 0.7);
    position: relative;
}

.control-group label[for="realityDistortionToggle"]::after,
.control-group label[for="quantumFragmentationToggle"]::after,
.control-group label[for="dimensionSpliceToggle"]::after,
.control-group label[for="timeEchoToggle"]::after,
.control-group label[for="realityBreachToggle"]::after {
    content: "extreme";
    position: absolute;
    right: 0;
    top: 0;
    font-size: 0.7em;
    background: linear-gradient(90deg, #ff00aa, #9900ff);
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    text-shadow: none;
}

/* Style for the extreme effect switches */
.control-group:has(label[for="realityDistortionToggle"]) .switch,
.control-group:has(label[for="quantumFragmentationToggle"]) .switch,
.control-group:has(label[for="dimensionSpliceToggle"]) .switch,
.control-group:has(label[for="timeEchoToggle"]) .switch,
.control-group:has(label[for="realityBreachToggle"]) .switch {
    background: linear-gradient(90deg, #ff00aa, #00ffaa);
}

.control-group:has(label[for="realityDistortionToggle"]) input:checked + .slider,
.control-group:has(label[for="quantumFragmentationToggle"]) input:checked + .slider,
.control-group:has(label[for="dimensionSpliceToggle"]) input:checked + .slider,
.control-group:has(label[for="timeEchoToggle"]) input:checked + .slider,
.control-group:has(label[for="realityBreachToggle"]) input:checked + .slider {
    background-color: #ff00aa;
}

/* Add a subtle glitch animation to the extreme effect labels */
@keyframes labelGlitch {
    0% {
        transform: translate(0);
        opacity: 1;
    }
    2% {
        transform: translate(-3px, 1px);
        opacity: 0.8;
    }
    4% {
        transform: translate(3px, -1px);
        opacity: 1;
    }
    6% {
        transform: translate(0);
        opacity: 1;
    }
    100% {
        transform: translate(0);
        opacity: 1;
    }
}

.control-group label[for="realityDistortionToggle"],
.control-group label[for="quantumFragmentationToggle"],
.control-group label[for="dimensionSpliceToggle"],
.control-group label[for="timeEchoToggle"],
.control-group label[for="realityBreachToggle"] {
    animation: labelGlitch 5s infinite;
    animation-delay: calc(var(--i, 0) * 0.5s);
}

.control-group label[for="realityDistortionToggle"] {
    --i: 0;
}
.control-group label[for="quantumFragmentationToggle"] {
    --i: 1;
}
.control-group label[for="dimensionSpliceToggle"] {
    --i: 2;
}
.control-group label[for="timeEchoToggle"] {
    --i: 3;
}
.control-group label[for="realityBreachToggle"] {
    --i: 4;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 3px;
    outline: none;
    position: relative;
}

input[type="range"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 170, 0.1));
    border-radius: 3px;
    pointer-events: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00ffaa, #00ccff);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 170, 0.7);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00ffaa, #00ccff);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 170, 0.7);
    border: none;
}

.toggle-container {
    display: flex;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 12px;
    transition: .4s;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(30, 30, 50, 0.8);
    transition: .4s;
    border-radius: 12px;
}

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

input:checked + .slider {
    background-color: #00ffaa;
}

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

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

button {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.3s ease;
    opacity: 0;
}

button:hover::after {
    opacity: 1;
    left: 0;
}

#randomizeBtn {
    background: linear-gradient(90deg, #8a2be2, #4a00e0);
    color: white;
}

#randomizeBtn:hover {
    background: linear-gradient(90deg, #9a3bf2, #5a10f0);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
}

#resetBtn {
    background: linear-gradient(90deg, #444, #222);
    color: white;
}

#resetBtn:hover {
    background: linear-gradient(90deg, #555, #333);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.download-button {
    width: 100%;
    background: linear-gradient(90deg, #00ffaa, #00cc88);
    color: #000;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    margin-bottom: 1rem;
}

.download-button:hover {
    background: linear-gradient(90deg, #00ffbb, #00dd99);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 170, 0.4);
}

.animation-button {
    width: 100%;
    background: linear-gradient(90deg, #ff00aa, #cc0088);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.animation-button:hover {
    background: linear-gradient(90deg, #ff00bb, #dd0099);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 170, 0.4);
}

.animation-button:before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right, 
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg);
    animation: glint 2s infinite;
    pointer-events: none;
}

@keyframes glint {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

@media screen and (max-width: 968px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    .image-preview-container {
        height: 400px;
    }
}