body {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Georgia', serif;
    margin: 0;
    padding: 20px;
    padding-top: 0px;
    background-color: #f5f1e8;
    color: #5d4e37;
    min-height: 100vh;
}

h2 {
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #5d4e37;
    text-align: center;
}

#main-container {
    display: flex;
    width: 100%;
    margin-bottom: 30px;
    gap: 20px;
    height: calc(100vh - 320px); /* Account for header, margins, and math section */
    min-height: 500px;
}

/* Left panel: new panel for future content */
#left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.panel-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0d5c7;
    height: 100%;
    min-height: 200px;
    color: #999;
    font-style: italic;
}

.panel-container::after {
    content: "Future content area";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #bbb;
}

/* Center panel: canvas */
#center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#controls {
    background-color: #ede4d3;
    border: 2px solid #d4c4a8;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#controls button {
    background-color: #d4c4a8;
    border: 1px solid #b8a082;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 16px;
    color: #5d4e37;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: 'Georgia', serif;
    width: 100%;
    max-width: 200px;
}

#controls button:hover {
    background-color: #c4b49a;
}

.checkbox-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 200px;
}

.checkbox-line label {
    font-size: 16px;
    color: #5d4e37;
    font-family: 'Georgia', serif;
    margin: 0;
}

.checkbox-line input[type="checkbox"] {
    margin: 0;
    accent-color: #b8a082;
}

#plotContainer {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0d5c7;
    flex: 1;
    min-height: 300px;
}

#plotCanvas {
    cursor: crosshair;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
}

/* Math display - now below everything with fixed height */
#mathDisplay {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #e0d5c7;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    color: #5d4e37;
}

.latex-block {
    margin-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: #5d4e37;
}

/* Highlight styles for LaTeX elements */
.hl {
    background: rgba(212, 196, 168, 0.6);
    padding: 0 0.18em;
    margin: 0 -0.18em;
    border-radius: 0.25em;
    transition: background-color 250ms ease;
}

.hl-hover {
    background: rgba(93, 78, 55, 0.3);
    padding: 0 0.18em;
    margin: 0 -0.18em;
    border-radius: 0.25em;
    transition: background-color 250ms ease;
}

label {
    font-size: 16px;
    margin-left: 5px;
    color: #5d4e37;
    font-family: 'Georgia', serif;
}

/* Table styling */
#right-panel {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
}

#pointsTable {
    border-collapse: collapse;
    width: 100%;
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0d5c7;
    table-layout: fixed;
}

#pointsTable th,
#pointsTable td {
    border: 1px solid #e0d5c7;
    padding: 12px;
    text-align: center;
    font-size: 16px;
    color: #5d4e37;
    font-family: 'Georgia', serif;
    width: 33.33%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#pointsTable th {
    background-color: #ede4d3;
    font-weight: bold;
    border-bottom: 2px solid #d4c4a8;
}

#pointsTable tbody tr:nth-child(even) {
    background-color: #f8f5f0;
}

#pointsTable tbody tr:hover {
    background-color: #ede4d3;
}

.ghost-row {
    opacity: 0.6;
    font-style: italic;
    background-color: #f0f0f0 !important;
}

/* Hoverable table cells */
.hoverable-cell {
    cursor: pointer;
    transition: background-color 200ms ease;
}

.hoverable-cell:hover {
    background-color: rgba(184, 160, 130, 0.2) !important;
}

/* Responsive design */
@media (max-width: 1024px) {
    #main-container {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }
    
    #left-panel, #center-panel {
        flex: none;
        min-height: 300px;
    }
    
    #right-panel {
        flex: none;
    }
    
    #plotContainer {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    #controls {
        justify-content: center;
    }
    
    body {
        padding: 10px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    #main-container {
        gap: 15px;
    }
}

/* MathJax styling to match theme */
.MathJax {
    color: #5d4e37 !important;
}

mjx-container {
    color: #5d4e37 !important;
}

mjx-math {
    color: #5d4e37 !important;
}
