:root {
    --primary: #FFCB05; /* Pokemon Yellow */
    --secondary: #2A75BB; /* Pokemon Blue */
    --accent: #FF0000; /* Pokeball Red */
    --dark: #121212;
    --dark-alt: #1E1E1E;
    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius: 16px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animations */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 10s infinite ease-in-out alternate;
}

.blob.yellow {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob.blue {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.blob.red {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
    animation-duration: 15s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Layout */
.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    z-index: 1;
}

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

header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary), #FFDE55);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header h1 span {
    color: var(--text-main);
    -webkit-text-fill-color: var(--text-main);
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Glassmorphism Card */
.glassmorphism {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
}

.generator-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2.5rem;
}

@media (max-width: 768px) {
    .generator-card {
        grid-template-columns: 1fr;
    }
}

/* Form Controls */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

input[type="text"] {
    width: 100%;
    padding: 1rem 1.2rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1.1rem;
    transition: var(--transition);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 203, 5, 0.2);
}

select {
    width: 100%;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    appearance: none; /* Helps with cross-browser styling */
}

select option {
    background: var(--dark-alt);
    color: white;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
}

/* Color Picker Customization */
.color-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.color-hex {
    font-family: monospace;
    font-size: 1rem;
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    outline: none;
    margin-top: 10px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: -2px;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    transition: var(--transition);
}

.custom-checkbox:hover input ~ .checkmark {
    background-color: rgba(255, 255, 255, 0.1);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 8px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid var(--dark);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn.primary {
    background-color: var(--primary);
    color: var(--dark);
}

.btn.primary:hover:not(:disabled) {
    background-color: #FFDE55;
    transform: translateY(-2px);
}

.btn.accent {
   background-color: var(--secondary);
   color: white;
}
.btn.accent:hover {
   background-color: #3b8ce0;
   transform: translateY(-2px);
}

.btn:disabled {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
}

.canvas-container {
    flex-grow: 1;
    min-height: 200px;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background-color: rgba(0,0,0,0.3);
}

.checkerboard {
    background-image: 
        linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%), 
        linear-gradient(-45deg, rgba(255,255,255,0.05) 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.05) 75%), 
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.05) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

#result-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-msg {
    color: #ff6b6b;
    text-align: center;
    padding: 1rem;
    font-weight: 500;
}

/* Content Section Elements */
.content-section {
    margin-top: 2rem;
    padding: 2.5rem;
    line-height: 1.6;
}

.content-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.content-section h3 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: var(--secondary);
}

.content-section p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.content-section ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

.content-section li {
    margin-bottom: 0.5rem;
}

.content-section strong {
    color: var(--text-main);
}
