* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden
}

.container {
    display: flex;
    height: 100vh;
    background: rgba(255, 255, 255, .95)
}

.controls {
    width: 450px;
    background: #fff;
    overflow-y: auto;
    border-right: 2px solid #e0e0e0;
    padding: 20px
}

.network {
    flex: 1;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: #fff;
    padding: 20px;
    text-align: center;
    margin: -20px -20px 20px -20px
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
    font-weight: 300
}

.group {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #3498db
}

.group h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px
}

.row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px
}

.row label {
    min-width: 120px;
    font-weight: 500;
    color: #555;
    font-size: 14px
}

.info {
    width: 16px;
    height: 16px;
    background: #3498db;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    cursor: help;
    position: relative;
    flex-shrink: 0
}

.info:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 100%;
    margin-bottom: 5px;
    background: #2c3e50;
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 1000;
    width: max-content;
    max-width: 150px;
    /* Reduced from 200px */
    text-align: center;
    white-space: normal;
}

input[type=number] {
    width: 80px;
    padding: 6px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    transition: border-color .3s
}

input[type=range] {
    flex: 1;
    margin: 0 8px
}

input[type=text] {
    width: 150px;
    padding: 6px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px
}

input:focus {
    outline: 0;
    border-color: #3498db
}

button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border: 0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all .3s;
    margin: 2px
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(52, 152, 219, .3)
}

.btn-train {
    background: linear-gradient(135deg, #27ae60, #2ecc71)
}

.btn-reset {
    background: linear-gradient(135deg, #e74c3c, #c0392b)
}

/* Neuron highlight buttons */
.neuron-buttons {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.neuron-buttons h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #2c3e50;
    font-weight: 600;
}

.neuron-button {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: #fff;
    border: 0;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    margin: 2px;
    min-width: 24px;
    transition: all .2s;
}

.neuron-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(108, 117, 125, .3);
}

.neuron-button.active {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 2px 8px rgba(243, 156, 18, .4);
}

.neuron-button.active:hover {
    box-shadow: 0 3px 10px rgba(243, 156, 18, .5);
}

.neuron-layer-group {
    margin-bottom: 8px;
}

.neuron-layer-label {
    font-size: 10px;
    color: #6c757d;
    margin-bottom: 3px;
    font-weight: 500;
}

#canvas {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .1);
    cursor: grab
}

#canvas:active {
    cursor: grabbing
}

.info-panel {
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    max-width: 1000px;
    width: 100%
}

.weights {
    max-height: 400px;
    overflow-y: auto
}

.weight-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    padding-left: 10px;
    gap: 6px;
    font-size: 12px
}

.weight-label {
    min-width: 50px;
    font-weight: 500;
    color: #555
}

.slider-container {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 6px
}

.training {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 8px;
    background: #fff;
    font-size: 12px
}

.layer {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0
}

.layer-title {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 13px
}

.binary-display {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    display: flex;
    gap: 15px
}

.binary-vectors {
    flex: 1;
    min-width: 200px;
}

.binary-layer {
    margin-bottom: 8px;
    padding: 8px 12px;
    margin: 6px 0;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.binary-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 13px;
}

.binary-vector {
    font-family: 'Courier New', monospace;
    color: #555;
    font-size: 12px;
}

.full-binary {
    padding: 12px;
    margin: 10px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.full-binary-title {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 14px;
}

.full-binary-vector {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
}

.decision-plot {
    width: 300px;
    height: 300px;
    position: relative;
}

.plot-legend {
    margin-top: 8px;
    font-size: 11px;
    color: #666;
    text-align: center;
    font-style: italic;
}

.window-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.movable-window {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px;
    z-index: 1000;
    top: 20px;
}

.window-header {
    padding: 5px;
    margin-bottom: 10px;
    font-weight: bold;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    cursor: move;
    user-select: none;
}

.plot-layout {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.plot-layout.side.by.side {
    flex-direction: row;
}

.plot-layout.stacked {
    flex-direction: column;
}

.plot-window {
    flex: 1;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    position: relative;
}

.plot-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.vis3d-container {
    width: 100%;
    height: 300px;
    position: relative;
    margin-top: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    display: none;
}

#vis3d-canvas {
    width: 100%;
    height: 100%;
}

.plot-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

.plot-switch label {
    font-size: 12px;
    color: #555;
}

.switch-toggle {
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    padding: 2px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s;
}

.switch-toggle.active {
    background: #2196F3;
}

.switch-toggle::before {
    content: '';
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    left: 2px;
    transition: transform 0.3s;
}

.switch-toggle.active::before {
    transform: translateX(20px);
}

/* Loss Graph Styles */
.loss-graph-container {
    width: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    position: relative;
}

.loss-graph-container .window-header {
    padding: 5px 0;
    margin-bottom: 15px;
    font-weight: bold;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-size: 14px;
}

#loss-graph-canvas {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    display: block;
    margin: 0 auto;
}

.loss-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.loss-stats {
    font-size: 11px;
    color: #666;
    text-align: right;
}

.loss-stats strong {
    color: #333;
}

/* Neighboring States styling */
.neighboring-states {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.neighboring-states .neighbor-item {
    margin: 5px 0;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    font-size: 12px;
}

.neighboring-states .neighbor-state {
    font-weight: 500;
    font-family: monospace;
    color: #2c3e50;
}

.neighboring-states .neighbor-diff {
    color: #666;
    font-size: 11px;
    margin-top: 2px;
}
