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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

.controls {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group label {
    font-weight: 600;
    color: #495057;
    min-width: 60px;
}

.control-group input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
}

.control-group input[type="range"] {
    width: 100px;
}

.control-group input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.control-group button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

#resize-btn {
    background: #007bff;
    color: white;
}

#resize-btn:hover {
    background: #0056b3;
}

#clear-btn {
    background: #dc3545;
    color: white;
}

#clear-btn:hover {
    background: #c82333;
}

#download-btn {
    background: #28a745;
    color: white;
}

#download-btn:hover {
    background: #218838;
}

#classify-btn {
    background: blue;
    color: white;
}

#classify-btn:hover {
    background: darkblue;
}

#brush-size-value {
    font-weight: 600;
    color: #495057;
    min-width: 20px;
}

.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
    background: #f8f9fa;
}

.results-container {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#canvas {
    border: 3px solid #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    cursor: crosshair;
    transition: box-shadow 0.3s ease;
}

#canvas:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Classification Result Styles */
.classification-result {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
    padding: 20px;
}

.classification-result h3 {
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.5em;
}

.classification-result p {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.classification-result .probabilities h4 {
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
}

.prob-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prob-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.prob-item .digit {
    font-weight: bold;
    color: #495057;
    min-width: 20px;
    text-align: center;
}

.prob-bar {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.prob-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.prob-value {
    font-weight: 600;
    color: #495057;
    min-width: 50px;
    text-align: right;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: center;
    }
    
    .main-content {
        flex-direction: column;
        padding: 10px;
    }
    
    .results-container {
        flex: none;
        width: 100%;
    }
    
    .canvas-container {
        padding: 10px;
    }
    
    .classification-result {
        margin: 10px 0;
        padding: 15px;
    }
    
    .prob-item {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    
    .prob-item .digit,
    .prob-item .prob-value {
        text-align: center;
    }
}