/* Dark Theme Background */
html.dark body {
    background-color: #0b0f19;
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(15, 23, 42, 0.8) 0px, transparent 50%);
    background-attachment: fixed;
    color: #f8fafc;
}

/* Light Theme Background */
html:not(.dark) body {
    background-color: #f1f5f9;
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.06) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: #0f172a;
}

/* Glass Panel Styling Dynamic */
html.dark .glass-panel {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
html:not(.dark) .glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Glass Card Light Dynamic */
html.dark .glass-card-light {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
html.dark .glass-card-light:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(16, 185, 129, 0.3);
}
html:not(.dark) .glass-card-light {
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(226, 232, 240, 1);
}
html:not(.dark) .glass-card-light:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(16, 185, 129, 0.4);
}

.preview-wrapper {
    perspective: 1000px;
}

.preview-container {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 85.6 / 53.98;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.15),
        0 25px 50px -12px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(16, 185, 129, 0.15);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

html:not(.dark) .preview-container {
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.08),
        0 20px 40px -12px rgba(0, 0, 0, 0.15),
        0 0 25px rgba(16, 185, 129, 0.1);
}

.preview-container:hover {
    transform: translateY(-6px) rotateX(2deg) rotateY(-2deg);
    box-shadow: 
        0 0 0 1px rgba(16, 185, 129, 0.4),
        0 30px 60px -15px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(16, 185, 129, 0.25);
}

#renderCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 18px;
}

/* Input Custom Dynamic */
html.dark .custom-input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}
html:not(.dark) .custom-input {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

.custom-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    outline: none;
}

.spinner {
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }