body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f4f4;
    color: #333;
    display: flex;
    justify-content: center;
    line-height: 1.6;
}

.container {
    width: 95%;
    max-width: 1600px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

header h1 { text-align: center; margin-bottom: 20px; }
.main-content { display: flex; flex-wrap: wrap; gap: 20px; }
.left-panel { flex: 0 0 auto; }
.right-panel {
    flex: 1;
    min-width: 350px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
}

.ca-display-container {
    margin-bottom: 15px;
    border: 1px solid #ccc;
    display: inline-block;
    width: fit-content;
}

#ncaCanvas { display: block; background: #eee; cursor: crosshair; }
.controls { padding: 10px; border-radius: 5px; background: #fdfdfd; }
.control-section {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 10px 15px;
    margin-bottom: 15px;
    background: #f8f8f8;
}
.control-section h3 {
    margin: 0 0 10px;
    color: #555;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    font-size: 1.1em;
}

.controls label {
    display: inline-block;
    margin: 8px 5px 5px 0;
    font-weight: bold;
    font-size: 0.9em;
}
.controls input[type="text"],
.controls input[type="number"],
.controls select {
    padding: 7px;
    margin-right: 10px;
    margin-bottom: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.controls input[type="range"] { vertical-align: middle; margin-bottom: 5px; }
.controls button {
    padding: 8px 12px;
    background: #5cb85c;
    color: #fff;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    margin: 5px 2px;
    font-size: 0.9em;
}
.controls button:hover { background: #4cae4c; }
.controls button:disabled { background: #ccc; cursor: not-allowed; opacity: 0.7; }

#toggleRunButton.running { background: #d9534f; }
#toggleRunButton.running:hover { background: #c9302c; }
#captureScreenshotButton { background: #28a745; }
#captureScreenshotButton:hover { background: #218838; }
#toggleRecordingButton { background: #007bff; }
#toggleRecordingButton:hover { background: #0056b3; }
#toggleRecordingButton.recording { background: #dc3545; }
#toggleRecordingButton.recording:hover { background: #c82333; }

#layerBuilderContainer .layer-input-group {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}
#layerBuilderContainer .layer-input-group label { margin-right: 5px; min-width: 130px; }
#layerBuilderContainer .layer-input-group input[type="number"] { width: 60px; }

.right-panel h2 { margin-top: 0; color: #555; }
#cellInfoLabel { font-weight: bold; margin-bottom: 10px; }
#clearSelectionButton {
    margin-left: 10px;
    padding: 5px 8px;
    font-size: 0.8em;
    background: #777;
    color: #fff;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}
#clearSelectionButton:hover { background: #555; }

.info-explanation {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 4px;
    background: #f0f0f0;
}
#neighborhoodDisplay, #activationDisplay {
    background: #e8e8e8;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    margin-bottom: 10px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.9em;
    border: 1px solid #ddd;
}

.network-viz-container {
    position: relative;
    width: 100%;
    height: 300px;
    border: 1px solid #ccc;
    margin-top: 10px;
    overflow: hidden;
}
#networkCanvas { width: 100%; height: 100%; background: #f0f0f0; }
.network-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.85);
    padding: 8px;
    border-radius: 5px;
    font-size: 0.8em;
    border: 1px solid #ddd;
    z-index: 10;
}
.network-legend div { margin-bottom: 5px; display: flex; align-items: center; }
.network-legend .color-box {
    width: 15px;
    height: 15px;
    border: 1px solid #333;
    margin-right: 8px;
    display: inline-block;
}

.collapsible {
    background: #e2e2e2;
    color: #333;
    cursor: pointer;
    padding: 15px 20px;
    width: 100%;
    border: 0;
    text-align: left;
    outline: none;
    font-size: 1.05em;
    font-weight: bold;
    transition: 0.3s;
    margin-top: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.collapsible.active, .collapsible:hover { background: #d0d0d0; }
.collapsible::after { content: '\02795'; font-size: 13px; color: #555; float: right; margin-left: 5px; }
.collapsible.active::after { content: '\2796'; }
.content {
    padding: 0 18px;
    display: none;
    overflow: hidden;
    background: #f9f9f9;
    border: 0 solid #e0e0e0;
    border-width: 0 1px 1px;
    border-radius: 0 0 4px 4px;
}
.content > .controls { border: 0; background: transparent; padding-top: 15px; }
#recordingTimer { margin-left: 15px; font-size: 1.1em; font-weight: bold; color: #007bff; vertical-align: middle; }
