:root {
    /* --- Intense Bright Red Theme --- */
    --glass-bg: rgba(0, 0, 0, 0.067); /* Dark glass for contrast */
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff; /* Bright white text */
    /* --- Reduced Red Tone --- */
    --primary-color: #e53935; /* A strong but less electric red */
    --primary-hover: #c62828;
    --success-color: #00e676;
    --success-hover: #33eb91;
}

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

body {
    font-family: 'Inter', sans-serif;
    /* --- New, less intense Red Gradient --- */
    background: #b71c1c; /* Fallback */
    background: linear-gradient(45deg, #d32f2f, #880e4f, #d32f2f); /* A mix of deep red and a hint of magenta */
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 550px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
    z-index: 1;
    margin: 2rem 0;
}

h1 {
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--text-color);
    text-shadow: 0 0 15px var(--text-color);
}

.upload-box {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--glass-border);
    border-radius: 15px;
    padding: 1rem;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.upload-box.dragover {
    border-color: var(--primary-color);
    background-color: rgba(229, 57, 53, 0.2);
}

.upload-label {
    /* --- This is the fix --- */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    /* --- End of fix --- */

    font-weight: 500;
    color: var(--text-color);
    opacity: 0.8;
    cursor: pointer;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    display: none;
}

.original-dimensions {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 1rem;
    display: none;
}

.options-box {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
}

.dimension-box label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    opacity: 0.9;
    display: block;
    text-align: left;
}

.dimension-box input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.3s;
}

.dimension-box input:focus {
    border-color: var(--primary-color);
}

.aspect-ratio-box {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

#aspect-ratio-lock {
    accent-color: var(--primary-color);
}

.btn {
    grid-column: 1 / -1;
    background-color: var(--primary-color);
    color: white;
    padding: 0.9rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.download-box {
    margin-top: 2rem;
}

#output-canvas {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    margin: 1rem 0;
}

.btn-download {
    background-color: var(--success-color);
    text-decoration: none;
}

.btn-download:hover {
    background-color: var(--success-hover);
}

.hidden {
    display: none;
}