:root {
    --font-family: 'Poppins', sans-serif;
    --background-gradient: linear-gradient(to bottom right, #1d1d1d, #484848);
    --text-color: #000000;
    --container-bg: linear-gradient(to bottom, #ffffff, #b2b2b2);
    --container-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --container-radius: 0.75rem;
    --header-gradient: linear-gradient(to right, #a78bfa, #f472b6, #ef4444);
    --header-color: transparent;
    --secondary-text-color: #ffffff;
    --label-color: #000000;
    --button-bg: #ff7a00;
    --button-hover-bg: #000000;
    --button-text-color: #ffffff;
    --clear-button-bg: #ef4444;
    --clear-button-hover-bg: #dc2626;
    --panel-bg: linear-gradient(to bottom, #ff7a00, #fbab5b);
    --panel-border: #ffffff;
    --panel-heading-color: #ffffff;
    --button-color: #000000;
    --range-thumb-color: #000000;
    --range-track-color: #ffffff;
    --effect-button-bg: #ffffff;
    --effect-button-hover-bg: #ff7a00;
    --effect-button-hover-text: #ffffff;
    --effect-button-active-bg: linear-gradient(to bottom, #ff7a00, #fbab5b);
    --effect-button-active-text: #ffffff;
    --canvas-bg: #ffffff;
    --canvas-border: #ffffff;
    --footer-text-color: #2e2e2e;
    --selection-bg: #000000;
    --selection-text: white;
}

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

body {
    font-family: var(--font-family);
    background: var(--background-gradient);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overscroll-behavior: none;
}

#app-container {
    background: var(--container-bg);
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
    box-shadow: var(--container-shadow);
    border-radius: var(--container-radius);
    padding: 1rem;
    width: 100%;
    max-width: 64rem;
}

@media (min-width: 640px) {
    #app-container {
        padding: 1.5rem;
    }
}
@media (min-width: 768px) {
    #app-container {
        padding: 2rem;
    }
}

header {
    margin-bottom: 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    background-image: var(--header-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: var(--header-color);
}
@media (min-width: 640px) {
    header h1 {
        font-size: 2.25rem;
    }
}

header p {
    color: var(--primary-text-color);
    margin-top: 0.25rem;
}

.logo {
    display: block;
    margin: 0 auto;
    width: 50%;
    height: auto;
    margin-bottom: 1rem;
}

.logo img {
    width: 100%;
    height: auto;
}

#controls-area {
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}
@media (min-width: 768px) {
    #controls-area {
        grid-template-columns: repeat(3, 1fr);
    }
}

#controls-area > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (min-width: 768px) {
    #controls-area > div:first-child {
        grid-column: span 1 / span 1;
    }
}

label[for="imageUpload"] {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--label-color);
    margin-bottom: 0.25rem;
}
#imageUpload {
    width: 100%;
    font-size: 0.875rem;
    color: var(--primary-text-color);
    cursor: pointer;
}
#imageUpload::file-selector-button {
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 0;
    font-size: 0.875rem;
    font-weight: 600;
    background-color: var(--button-bg);
    color: var(--button-text-color);
    transition: background-color 0.2s ease-in-out;
}
#imageUpload::file-selector-button:hover {
    background-color: var(--button-hover-bg);
}

#clearEffectsButton {
    width: 100%;
    background-color: var(--clear-button-bg);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}
#clearEffectsButton:hover {
    background-color: var(--clear-button-hover-bg);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.control-panel {
    background: var(--panel-bg);
    background-clip: padding-box;
    border: 2px solid var(--panel-border);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
}
@media (min-width: 768px) {
    .control-panel {
        grid-column: span 2 / span 2;
    }
}

.control-panel h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--panel-heading-color);
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}
.control-panel .controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem 1rem;
}
@media (min-width: 640px) {
    .control-panel .controls-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
.control-panel .controls-grid > div:last-child {
    grid-column: span 1 / span 1;
}
@media (min-width: 640px) {
    .control-panel .controls-grid > div:last-child {
        grid-column: span 2 / span 2;
    }
}

.control-panel label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--secondary-text-color);
}
.control-panel input[type="range"] {
    width: 100%;
    accent-color: var(--range-thumb-color);
    height: 0.5rem;
    background-color: var(--range-track-color);
    border-radius: 0.5rem;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.control-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1rem;
    height: 1rem;
    background: var(--range-thumb-color);
    border-radius: 50%;
    cursor: pointer;
}
.control-panel input[type="range"]::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    background: var(--range-thumb-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.control-panel input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--panel-border);
    border-radius: 0.375rem;
    padding: 2px;
    background-color: var(--panel-border);
    cursor: pointer;
}
.control-panel .value-display {
    font-size: 0.75rem;
    color: var(--secondary-text-color);
    text-align: right;
}

#effect-selector-container {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: rgba(51, 65, 85, 0.5);
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    white-space: nowrap;
}
#effect-selector-container::-webkit-scrollbar {
    height: 8px;
}
#effect-selector-container::-webkit-scrollbar-track {
    background: var(--panel-border);
    border-radius: 10px;
}
#effect-selector-container::-webkit-scrollbar-thumb {
    background: var(--secondary-text-color);
    border-radius: 10px;
}
#effect-selector-container::-webkit-scrollbar-thumb:hover {
    background: var(--label-color);
}

.effect-button {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    background-color: var(--effect-button-bg);
    color: var(--button-color);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.effect-button:hover {
    background-color: var(--effect-button-hover-bg);
    color: var(--effect-button-hover-text);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.effect-button.active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    background-image: var(--effect-button-active-bg);
    color: var(--effect-button-active-text);
    font-weight: 600;
}

#canvas-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: var(--canvas-bg);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 2px solid var(--canvas-border);
}
#mainCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--footer-text-color);
}

::selection {
    background-color: var(--selection-bg);
    color: var(--selection-text);
}
