body {
    margin: 0;
    overflow: hidden;
    background: #050a14;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
}

canvas {
    display: block;
    touch-action: none;
}

#ui-layer {
    position: absolute;
    top: 10px;
    left: 10px;
    pointer-events: none;
    z-index: 10;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.stat-box {
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #c41e3a;
    margin-bottom: 5px;
}

.btn-container {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}

.control-btn {
    background: #c41e3a;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-transform: uppercase;
    font-size: 11px;
    box-shadow: 0 4px 0 #8a1429;
}

.control-btn:hover {
    background: #e02d4d;
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(2px);
    box-shadow: 0 0px 0 #8a1429;
}

.control-btn.secondary {
    background: #225e32;
    box-shadow: 0 4px 0 #143d20;
}

.controls-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #225e32;
    pointer-events: none;
    font-size: 12px;
}

#nn-visualizer {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    pointer-events: none;
}

#loss-chart-container {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    pointer-events: none;
}

#loss-legend {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Training indicator */
#training-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #facc15;
    border-radius: 12px;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #facc15;
    z-index: 100;
    box-shadow: 0 0 30px rgba(250, 204, 21, 0.3);
}

#training-indicator.hidden {
    display: none;
}

.training-pulse {
    width: 20px;
    height: 20px;
    background: #facc15;
    border-radius: 50%;
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
}

/* Also pulse the learning box border during training */
#learning-box.training {
    border-color: #facc15;
    animation: border-pulse 0.8s ease-in-out infinite;
}

@keyframes border-pulse {
    0%, 100% {
        border-color: #facc15;
        box-shadow: 0 0 5px rgba(250, 204, 21, 0.3);
    }
    50% {
        border-color: #fef08a;
        box-shadow: 0 0 15px rgba(250, 204, 21, 0.6);
    }
}

