:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #a855f7;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --font-main: 'Outfit', sans-serif;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 25px;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

/* Mobile Nav Hide (Simple) */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
}

/* Hero Section */
.hero-section {
    padding: 60px 0 40px;
    text-align: center;
    background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-dark) 60%);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.2rem;
    }
}

.highlight {
    background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-text {
    max-width: 700px;
    margin: 0 auto 30px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.benefit-list {
    display: flex;
    justify-content: center;
    gap: 20px;
    list-style: none;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.benefit-list li {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Upload Area - RE PLACED WITH HIGH ENGAGING DESIGN */
.tool-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    min-height: 400px;
}

.upload-area {
    padding: 80px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px dashed var(--border);
    margin: 30px;
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.05) 0%, rgba(15, 23, 42, 0.3) 100%);
    position: relative;
    overflow: hidden;
}

/* Animated Border/Glow Effect on Hover */
.upload-area:hover {
    border-color: var(--primary);
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1) 0%, rgba(15, 23, 42, 0.4) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px -10px rgba(99, 102, 241, 0.3);
}

.upload-area.dragover {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    transform: scale(1.02);
}

.upload-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.icon-upload {
    color: var(--text-muted);
    margin-bottom: 25px;
    transition: 0.3s;
    background: rgba(255, 255, 255, 0.03);
    width: 90px;
    height: 90px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.upload-area:hover .icon-upload {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.upload-content h3 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.upload-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 400px;
    margin: 0 auto;
}

.upload-content p::after {
    content: 'Click to Browse Files';
    display: block;
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s;
}

.upload-area:hover .upload-content p::after {
    opacity: 1;
    transform: translateY(0);
}

/* Tool Editor (Preview + Controls) */
.tool-editor {
    display: flex;
    /* Flex layout for desktop */
    min-height: 500px;
}

.editor-layout {
    display: flex;
    width: 100%;
    flex-direction: column;
}

@media (min-width: 768px) {
    .editor-layout {
        flex-direction: row;
    }
}

.preview-container {
    flex: 2;
    background: #000;
    /* Dark bg for image contrast */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    /* Improve Image Rendering for Pixelation */
    image-rendering: pixelated;
    image-rendering: -webkit-optimize-contrast;
}

@media (min-width: 768px) {
    .preview-container {
        border-bottom: none;
        border-right: 1px solid var(--border);
    }
}

.img-container {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Ensure canvas also scales correctly */
#imagePreview,
#imageCanvas,
#resultImage {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    /* Crucial: Crisp edges for pixel art look */
    image-rendering: pixelated;
}

.file-info-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
}

/* Controls Panel */
.controls-panel {
    flex: 1;
    background: var(--bg-card);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.control-group h4 {
    margin-bottom: 12px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

/* Slider */
.slider-container {
    margin-bottom: 10px;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 5px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transition: 0.2s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Select Box */
.premium-select,
.select-wrapper {
    width: 100%;
}

.premium-select {
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.premium-select:focus {
    border-color: var(--primary);
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
}

.secondary-btn {
    padding: 12px 25px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

.secondary-btn:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

/* Helper Classes */
.hidden {
    display: none !important;
}

/* Result View */
.result-view {
    padding: 40px;
    text-align: center;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    animation: bounce 1s infinite;
}

.result-display img {
    margin: 20px 0;
    border: 2px solid var(--success);
}

.stats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Content Sections (SEO) */
.seo-content {
    padding: 60px 0;
    background: var(--bg-dark);
}

.content-block {
    max-width: 800px;
    margin: 0 auto 60px;
}

.content-block h2 {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 2rem;
}

.content-block h3 {
    color: var(--text-main);
    margin: 30px 0 15px;
    font-size: 1.4rem;
}

.text-content {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.text-content p {
    margin-bottom: 15px;
}

.text-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
}

.text-content li {
    margin-bottom: 8px;
}

/* Feature Grid for SEO */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.feature-item {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.feature-item h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.feature-item p {
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* FAQ Section - HIGH ENGAGING DESIGN UPDATE */
.faq-grid {
    display: grid;
    gap: 15px;
    max-width: 900px;
    margin: 30px auto 0;
}

.faq-item {
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.6) 100%);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 25px;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.faq-item:hover {
    transform: translateX(5px);
    background: var(--bg-card);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

.faq-item h4 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.faq-item h4::before {
    content: '?';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 800;
}

.faq-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    padding-left: 36px;
    /* Align strictly with text start */
}


/* Internal Linking Grid */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 30px auto;
}

.tool-link-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: 0.3s;
}

.tool-link-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.tool-link-card .icon {
    font-size: 1.5rem;
}

.tool-link-card .meta {
    display: flex;
    flex-direction: column;
}

.tool-link-card .meta strong {
    color: var(--text-main);
}

.tool-link-card .meta span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Footer (Updated for new request) */
.main-footer {
    background: #020617;
    /* Even darker */
    padding: 60px 0 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (max-width: 900px) {
    .footer-top {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .footer-top {
        grid-template-columns: 1fr;
    }
}

.brand-col .logo {
    display: block;
    margin-bottom: 15px;
}

.brand-desc {
    font-size: 0.9rem;
    margin-bottom: 20px;
    max-width: 250px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    color: var(--text-muted);
    transition: 0.3s;
}

.social-links a:hover {
    color: var(--primary);
}

.footer-col h4 {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.footer-col ul li a:hover {
    color: var(--primary);
    padding-left: 5px;
    /* Subtle slide */
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding: 25px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
    }
}

.copyright strong {
    color: var(--text-main);
}

.legal-links {
    display: flex;
    gap: 15px;
}

.separator {
    color: var(--border);
}

/* Loader */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}