/* --- Layout Overrides --- */
@media (min-width: 900px) {
    .module-layout {
        grid-template-columns: 280px 1fr !important; 
        gap: 2rem !important;
    }
}

/* --- Canvas Container --- */
.canvas-container {
    position: relative;
    width: 100%;
    height: 450px; 
    background: radial-gradient(circle at center, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
    overflow: hidden;
}

canvas { display: block; width: 100%; height: 100%; }

/* --- Sidebar Styling --- */
.data-sidebar {
    height: 450px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 1.5rem;
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
}

.data-card {
    background: rgba(255,255,255,0.92);
    padding: 1.5rem; 
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.data-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem; 
    color: var(--primary);
    border-bottom: 2px solid rgba(59, 89, 152, 0.1);
    padding-bottom: 0.8rem;
}

/* Data Stacks */
.data-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.data-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.data-val {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.4rem; 
}

/* --- Improved Formula Styling --- */
.formula-container {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.6rem;
    color: var(--text-main);
    padding: 0.5rem 0;
}

.var { margin: 0 3px; }
.eq, .op { margin: 0 5px; font-style: normal; opacity: 0.7; font-family: 'Poppins', sans-serif; font-size: 1.2rem;}
.const { font-style: normal; }
.sup { font-size: 0.6em; vertical-align: super; font-style: normal; margin-left: 1px; }

.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 4px;
    font-size: 0.9em;
}

.numerator { border-bottom: 1.5px solid var(--text-main); padding: 0 4px; text-align: center; width: 100%; }
.denominator { padding: 2px 4px 0; text-align: center; }


/* --- Controls Panel --- */
.ui-layer {
    position: absolute;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    z-index: 10;
    pointer-events: none;
}

.panel-bottom {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    border-top: 1px solid rgba(255,255,255,0.8);
    padding: 1.2rem 2rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.control-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.slider-col { flex: 1; }

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.val-display {
    font-family: 'Roboto Mono', monospace;
    color: var(--text-main);
    font-size: 0.85rem;
}

.panel-divider {
    width: 1px;
    height: 45px;
    background: rgba(0,0,0,0.1);
}

/* Custom Slider Styling */
input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px; 
    background: #cbd5e0;
    border-radius: 3px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15); 
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }