* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #2a4d69, #4b86b4);
    min-height: 100vh;
    /* display: flex; */
    /* justify-content: center; */
    /* align-items: center; */
    /* padding: 20px; */
    color: #fff;
}

canvas {
    will-change: transform;
}

.container {
    width: 100%;
    /* max-width: 1200px; */
    background: rgba(25, 25, 35, 0.85);
    /* border-radius: 15px; */
    /* padding: 25px; */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    height: 100vh;
    position: relative;
    z-index: 0;
}

header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(100, 150, 200, 0.3);
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #4facfe, #00f2fe);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: #a0d2eb;
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.content {
    display: flex;
    /* flex-wrap: wrap; */
    /* gap: 25px; */
    height: 100%;
}

.controls {
    /* flex: 1; */
    width: 26vw;
    background: rgba(30, 30, 45, 0.7);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.visualization {
    /* flex: 2; */
    /* width: 74vw; */
    background: rgba(25, 25, 35, 0.9);
    border-radius: 12px;
    /* padding: 20px; */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    /* flex-direction: column; */
}

.control-group {
    /* margin-bottom: 25px;
    padding-bottom: 20px; */
    border-bottom: 1px solid rgba(100, 150, 200, 0.3);
}

h2 {
    color: #64b5f6;
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

h2 i {
    margin-right: 10px;
    font-size: 1.3rem;
}

.input-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

label {
    width: 60px;
    color: #bbdefb;
    font-weight: 500;
    font-size: 1.05rem;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    background: #2c3e50;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #4facfe;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(79, 172, 254, 0.6);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(79, 172, 254, 0.8);
}

.value-display:not(#derivativeLevelValue) {
    width: 70px;
    text-align: center;
    background: rgba(50, 100, 150, 0.3);
    padding: 7px 10px;
    border-radius: 6px;
    font-weight: 500;
    font-family: 'Source Code Pro', monospace;
    color: #e0f7fa;
    font-size: 1.05rem;
    margin-left: 15px;
}

#derivativeLevelValue {
    text-align: center;
    background: rgba(50, 100, 150, 0.3);
    padding: 7px 10px;
    border-radius: 6px;
    font-weight: 500;
    font-family: 'Source Code Pro', monospace;
    color: #e0f7fa;
    font-size: 1.05rem;
    margin-left: 15px;
}

select {
    padding: 10px 15px;
    border-radius: 6px;
    background: #2c3e50;
    color: #e0f7fa;
    border: 1px solid #4facfe;
    width: 100%;
    font-size: 1.05rem;
    font-family: 'Source Code Pro', monospace;
    cursor: pointer;
}

.buttons {
    /* display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 25px; */
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 columns of equal width */
    grid-template-rows: auto auto auto;
    /* 3 rows; adjust as needed */
    gap: 10px;
    /* Optional: space between grid items */
}

button {
    flex: 1;
    min-width: 90px;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #2c3e50;
    color: #e0f7fa;
    border: 1px solid #4facfe;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Initial box-shadow is none or subtle */
    box-shadow: 0 0 0 rgba(0, 255, 255, 0);
    /* Smooth transition */
    transition: border 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

button i {
    margin-right: 8px;
    font-size: 1.2rem;
}

button:hover {
    transform: scale(1.05);
    ;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-color: #0ff;
    /* Neon cyan */
    box-shadow:
        0 0 5px #0ff,
        0 0 10px #0ff,
        0 0 20px #0ff,
        0 0 40px #0ff;
}

button:active {
    transform: translateY(1px);
}



#plot-container {
    position: relative;
    width: 58vw;
    height: 580px;
    background: #0f1721;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

#plot {
    width: 100%;
    height: 100%;
}

.info-panel {
    width: 16vw;
    background: rgba(20, 30, 48, 0.7);
    border-radius: 8px;
    padding: 15px;
    font-family: 'Source Code Pro', monospace;
    font-size: 1.15rem;
    color: #a0d2eb;
    box-sizing: border-box;
}

.coordinate-info {
    margin-bottom: 12px;
}

.derivative-info {
    color: #ff9a8b;
}

.instructions {
    background: rgba(40, 60, 80, 0.5);
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
    font-size: 1rem;
}

.instructions h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #4facfe;
    display: flex;
    align-items: center;
}

.instructions h3 i {
    margin-right: 10px;
}

.instructions ul {
    padding-left: 25px;
}

.instructions li {
    margin-bottom: 12px;
    line-height: 1.5;
}

footer {
    margin-top: 30px;
    text-align: center;
    color: #bbdefb;
    font-size: 1rem;
    padding-top: 20px;
    border-top: 1px solid rgba(100, 150, 200, 0.3);
}

.grid-container {
    display: grid;
    place-items: center;
    height: 100vh;
    gap: 1rem;
}

.grid-stack {
    display: grid;
    position: relative;
    width: 300px;
    height: 200px;
}

.toggleElement {
    grid-area: 1 / 1;
    position: absolute;
    top: 0;
    left: 0;
    /* width: 100%; height: 100%; */
    opacity: 0;
    /* transform: scale(0.95); */
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    /* background: #eee; */
    /* display: flex; */
    /* align-items: center; */
    /* justify-content: center; */
    /* border-radius: 8px; */
    /* box-shadow: 0 4px 8px rgba(0,0,0,0.1); */
}

/* Active element */
.toggleElement.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    z-index: 1;
}

@media (max-width: 900px) {
    .content {
        flex-direction: column;
    }

    .controls,
    .visualization {
        min-width: 100%;
    }
}

#custom {

    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 10;
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    background: rgba(25, 25, 35, 0.85);
    border: 1px solid #4facfe;
}

#custom.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

#customEquation {
    width: 100%;
    margin-bottom: 10px;
    height: 50px;
    border-radius: 6px;
    background: #2c3e50;
    color: #e0f7fa;
    border: 1px solid #4facfe;
}

.calculator-keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}

.calculator-keypad button {
    background: rgba(44, 62, 80, 0.6);
}

#closeBtn {
    margin-left: auto;
    position: absolute;
    top: 10px;
    right: 10px;
}

#toggleCalculator {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    font-size: 5rem;
}

.fa-calculator:hover {
    box-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 20px #0ff, 0 0 40px #0ff;
    border-radius: 10px;
}