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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Canvas Section */
.canvas-section {
    text-align: center;
}

.canvas-section h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.canvas-container {
    background: white;
    border: 3px solid #667eea;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#canvas {
    display: block;
    cursor: crosshair;
    background: white;
    border-radius: 8px;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* Results Section */
.results-section {
    text-align: center;
}

.results-section h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.results-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.placeholder {
    color: #999;
    font-size: 1.1em;
    text-align: center;
}

.prediction-result {
    width: 100%;
}

.predicted-digit {
    font-size: 5em;
    font-weight: bold;
    color: #667eea;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.confidence {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 30px;
}

.confidence-bar {
    background: #e0e0e0;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 30px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.probabilities-title {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.probability-bars {
    text-align: left;
}

.probability-item {
    margin-bottom: 10px;
}

.probability-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.digit-label {
    font-weight: 600;
    color: #333;
}

.probability-value {
    color: #667eea;
    font-weight: 600;
}

.probability-bar {
    background: #e0e0e0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.probability-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* Instructions */
.instructions {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.instructions ol {
    margin-left: 20px;
    line-height: 1.8;
    color: #555;
}

.instructions li {
    margin-bottom: 8px;
}

/* Footer */
footer {
    text-align: center;
    color: #999;
    font-size: 0.9em;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #c62828;
}
