* {
    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;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.back-button {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    transition: background 0.3s ease;
    font-size: 0.9em;
    font-weight: 600;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.back-icon {
    font-size: 1.2em;
}

.loading-models {
    background: #fff3cd;
    padding: 15px 25px;
    border-radius: 10px;
    border-left: 4px solid #ffc107;
    display: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    color: #856404;
}

.loading-models.show {
    display: block;
}

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

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

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 0.9em;
}

.canvas-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.canvas-wrapper {
    text-align: center;
}

.canvas-label {
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

canvas {
    border: 3px solid #667eea;
    cursor: crosshair;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

button {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.btn-predict:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-clear {
    background: #e74c3c;
    color: white;
}

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

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.loading {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    margin: 20px 0;
    display: none;
    font-size: 1.2em;
}

.loading.show {
    display: block;
}

.result {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    text-align: center;
    display: none;
}

.result.show {
    display: block;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result h2 {
    font-size: 4em;
    margin-bottom: 10px;
}

.result p {
    font-size: 1.2em;
    margin: 5px 0;
}

.confidence-bars {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
}

.confidence-bar {
    display: flex;
    align-items: center;
    margin: 8px 0;
}

.confidence-label {
    width: 30px;
    font-weight: bold;
}

.confidence-track {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 10px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    transition: width 0.5s ease;
    border-radius: 10px;
}

.confidence-value {
    min-width: 45px;
    text-align: right;
}

.info {
    background: #e8f4f8;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    font-size: 0.9em;
    color: #555;
    line-height: 1.8;
}

.info strong {
    color: #667eea;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .canvas-container {
        flex-direction: column;
    }
    
    .buttons {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
}
