@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&family=Inter:wght@300;400;500;600&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e9ecef;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header h1 {
    font-family: 'Courier Prime', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 20px #00d4ff;
    margin-bottom: 10px;
}

.header .subtitle {
    font-size: 1.1rem;
    color: #a8a8a8;
    font-weight: 300;
}

.badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #00d4ff;
    color: #1a1a2e;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Canvas Sections */
.canvas-section, .network-section, .prediction-section, .info-section, .tribute-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.canvas-section h3, .network-section h3, .prediction-section h3, .info-section h3, .tribute-section h3 {
    font-family: 'Courier Prime', monospace;
    font-size: 1.3rem;
    color: #00d4ff;
    margin-bottom: 20px;
}

.canvas-container {
    position: relative;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#drawingCanvas, #gridCanvas {
    position: absolute;
    top: 0;
    left: 0;
    background: #000000;
    cursor: crosshair;
    border-radius: 12px;
}

#gridCanvas {
    pointer-events: none;
}

#networkCanvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    width: 100%;
    height: 200px;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.control-group label {
    color: #c9c9c9;
    min-width: 100px;
}

.control-group input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00d4ff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 212, 255, 0.4);
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00d4ff;
}

#brushValue {
    font-family: 'Courier Prime', monospace;
    color: #00d4ff;
    font-weight: 600;
    min-width: 40px;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ff3838;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.btn-primary {
    background: #00d4ff;
    color: #1a1a2e;
}

.btn-primary:hover {
    background: #00b8e6;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

/* Predictions */
.main-prediction {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 12px;
}

.predicted-digit {
    font-family: 'Courier Prime', monospace;
    font-size: 4rem;
    font-weight: 700;
    color: #00d4ff;
    text-shadow: 0 0 20px #00d4ff;
}

.confidence {
    font-size: 1.5rem;
    color: #ffffff;
    margin-top: 10px;
}

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

.prediction-label {
    font-family: 'Courier Prime', monospace;
    font-weight: 600;
    color: #00d4ff;
    min-width: 20px;
}

.prediction-bar-bg {
    flex: 1;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.prediction-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #ffd700);
    transition: width 0.8s ease;
    border-radius: 4px;
}

.prediction-percentage {
    font-family: 'Courier Prime', monospace;
    color: #c9c9c9;
    min-width: 40px;
    font-size: 0.9rem;
}

.processing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Info Sections */
.mnist-facts {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 4px solid #00d4ff;
}

.mnist-facts p {
    line-height: 1.6;
    color: #e9ecef;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    color: #c9c9c9;
}

.stat-value {
    font-family: 'Courier Prime', monospace;
    color: #00d4ff;
    font-weight: 600;
}

.tribute-section blockquote {
    font-style: italic;
    font-size: 1rem;
    line-height: 1.6;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ffd700;
}

.network-controls {
    margin-top: 16px;
}

.network-controls label {
    display: block;
    margin-bottom: 8px;
    color: #c9c9c9;
    font-size: 0.9rem;
}

.network-controls input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
}

.network-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .badge {
        position: static;
        display: inline-block;
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.7rem;
    }
    
    .canvas-section, .network-section, .prediction-section, .info-section, .tribute-section {
        padding: 20px;
    }
    
    #drawingCanvas, #gridCanvas {
        width: 100%;
        height: auto;
        max-width: 280px;
        max-height: 280px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00b8e6;
}