/* Modern Baseline Features */
:root {
    --bg-color: oklch(20% 0.02 260);
    --text-primary: oklch(98% 0.01 260);
    --text-secondary: oklch(80% 0.02 260);
    --accent-color: oklch(70% 0.15 260);
    --surface-color: oklch(25% 0.03 260 / 0.8);
    --glow-shadow: 0 0 20px oklch(70% 0.15 260 / 0.3);
    --card-shadow: 0 10px 30px oklch(0% 0 0 / 0.5), 0 1px 2px oklch(100% 0 0 / 0.1);
}

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

body {
    font-family: 'Pretendard', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Texture overlay */
.noise {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.05;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.container {
    width: min(90%, 800px);
    padding-block: 4rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.hero {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    background: linear-gradient(to bottom, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.test-area {
    display: grid;
    gap: 2rem;
    container-type: inline-size;
}

/* Upload Section */
.upload-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    width: min(100%, 400px);
    margin-inline: auto;
    background-color: var(--surface-color);
    border-radius: 2rem;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    border: 2px dashed oklch(100% 0 0 / 0.1);
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
}

.upload-wrapper.dragover {
    border-color: var(--accent-color);
    background-color: oklch(25% 0.03 260 / 0.95);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
}

.upload-icon {
    color: var(--accent-color);
    opacity: 0.8;
}

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

.btn-upload {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--glow-shadow);
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px oklch(70% 0.15 260 / 0.5);
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background-color: oklch(0% 0 0 / 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(4px);
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--accent-color);
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
}

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

.hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Results Section */
.results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.result-item {
    background-color: var(--surface-color);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid oklch(100% 0 0 / 0.05);
    transition: transform 0.2s;
}

.result-item:hover {
    transform: scale(1.02);
}

.animal-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.probability-bar-bg {
    flex: 1;
    height: 8px;
    background-color: oklch(0% 0 0 / 0.2);
    border-radius: 4px;
    margin-inline: 1.5rem;
    overflow: hidden;
}

.probability-bar-fill {
    height: 100%;
    background-color: var(--accent-color);
    border-radius: 4px;
    transition: width 0.3s ease-out;
}

.probability-value {
    font-family: monospace;
    color: var(--accent-color);
    min-width: 3rem;
    text-align: right;
}

.footer {
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Container Query for Mobile-like Layouts */
@container (max-width: 500px) {
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .probability-bar-bg {
        margin-inline: 0;
        width: 100%;
    }
}
