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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    padding-bottom: 80px;
}

.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    transition: background 0.3s;
}

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

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

h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 8px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.animal-icons {
    font-size: 5rem;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 30px;
}

.animal-icon {
    animation: bounce 2s ease-in-out infinite;
}

.animal-icon.cat {
    animation-delay: 0.3s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.description {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background: #f0f0f0;
    color: #555;
}

button.secondary:hover {
    background: #e0e0e0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none !important;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #ccc;
    border-radius: 20px;
    padding: 40px 20px;
    margin: 20px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f5f5ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #ebe8ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-text {
    color: #555;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.upload-hint {
    color: #999;
    font-size: 0.9rem;
}

/* Preview Screen */
#preview-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#image-preview-container {
    width: 300px;
    height: 300px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: #f0f0f0;
}

#preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

#loading-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 600;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#analyze-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Result Screen */
#result-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#result-animal-icon {
    font-size: 6rem;
    animation: popIn 0.5s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

#result-title {
    font-size: 1.8rem;
    color: #333;
}

#result-percentage {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#result-description {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    padding: 0 10px;
    margin-bottom: 10px;
}

#probability-bars {
    width: 100%;
    margin-bottom: 10px;
}

.probability-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.probability-label {
    width: 80px;
    text-align: right;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.probability-bar-container {
    flex: 1;
    height: 24px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
}

.probability-bar {
    height: 100%;
    border-radius: 12px;
    transition: width 1s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    min-width: 45px;
}

.probability-bar.dog {
    background: linear-gradient(90deg, #f6d365 0%, #fda085 100%);
}

.probability-bar.cat {
    background: linear-gradient(90deg, #a8edea 0%, #fed6e3 100%);
    color: #666;
}

#retry-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .animal-icons {
        font-size: 4rem;
    }

    #image-preview-container {
        width: 250px;
        height: 250px;
    }

    #result-animal-icon {
        font-size: 5rem;
    }

    #result-percentage {
        font-size: 2.5rem;
    }

    .back-link {
        top: 10px;
        left: 10px;
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-icon {
        font-size: 3rem;
    }

    #button-group {
        width: 100%;
    }

    #button-group button {
        flex: 1;
        min-width: 120px;
    }
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px 20px;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #555;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #667eea;
}

.footer-copyright {
    color: #888;
    font-size: 0.7rem;
}
