*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #EFF6FF;
    color: #1E3A5F;
    font-family: 'DM Sans', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    background-image:
      radial-gradient(ellipse 60% 40% at 20% 10%, rgba(37,99,235,0.06) 0%, transparent 60%),
      radial-gradient(ellipse 40% 30% at 80% 80%, rgba(14,165,233,0.04) 0%, transparent 50%);
}

header {
    text-align: center;
    margin-bottom: 52px;
    animation: fadeDown 0.7s ease both;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #2563EB;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'DM Serif Display', serif;
    font-size: 2.4rem;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

header p {
    color: #64748B;
    font-size: 0.9rem;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card {
    background: #DBEAFE;
    border: 1px solid #93C5FD;
    border-radius: 16px;
    padding: 36px;
    width: 100%;
    max-width: 680px;
    animation: fadeUp 0.7s ease both;
}

.section-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2563EB;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #93C5FD;
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.upload-zone {
    border: 1.5px dashed #93C5FD;
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    background: #EFF6FF;
}
.upload-zone:hover, .upload-zone.has-file {
    border-color: #2563EB;
    background: #BFDBFE;
}
.upload-zone input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
    filter: grayscale(1);
    transition: filter 0.25s;
}
.upload-zone.has-file .upload-icon { filter: none; }
.upload-zone h3 {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: #1E3A5F;
}
.upload-zone p {
    font-size: 0.75rem;
    color: #64748B;
    font-family: 'DM Mono', monospace;
}
.upload-preview {
    width: 100%; height: 90px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    display: none;
}
.upload-zone.has-file .upload-preview { display: block; }
.upload-zone.has-file .upload-icon { display: none; }

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.field label {
    display: block;
    font-size: 0.75rem;
    font-family: 'DM Mono', monospace;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.field input, .field select {
    width: 100%;
    background: #EFF6FF;
    border: 1px solid #93C5FD;
    border-radius: 10px;
    color: #1E3A5F;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
}
.field input:focus, .field select:focus {
    border-color: #2563EB;
}
.field select option { background: #DBEAFE; color: #1E3A5F; }

.btn-predict {
    width: 100%;
    padding: 16px;
    background: #2563EB;
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.btn-predict:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(37,99,235,0.3); }
.btn-predict:active { transform: translateY(0); }
.btn-predict:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}
.btn-predict.loading .btn-text { display: none; }
.btn-predict.loading .spinner { display: block; }

.result-card {
    margin-top: 24px;
    border-radius: 16px;
    padding: 28px 32px;
    display: none;
    animation: fadeUp 0.4s ease both;
    border: 1px solid #93C5FD;
    background: #EFF6FF;
}
.result-card.anemic {
    background: rgba(220,38,38,0.05);
    border-color: rgba(220,38,38,0.3);
}
.result-card.non-anemic {
    background: rgba(5,150,105,0.05);
    border-color: rgba(5,150,105,0.3);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.result-label {
    font-family: 'DM Serif Display', serif;
    font-size: 1.8rem;
}
.result-card.anemic   .result-label { color: #DC2626; }
.result-card.non-anemic .result-label { color: #059669; }

.result-badge {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    padding: 6px 12px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.result-card.anemic   .result-badge { background: rgba(220,38,38,0.1); color: #DC2626; }
.result-card.non-anemic .result-badge { background: rgba(5,150,105,0.1); color: #059669; }

.confidence-bar-wrap { margin-bottom: 16px; }
.confidence-bar-wrap label {
    font-size: 0.75rem;
    font-family: 'DM Mono', monospace;
    color: #64748B;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.bar-track {
    height: 6px;
    background: #BFDBFE;
    border-radius: 99px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s cubic-bezier(0.16,1,0.3,1);
    width: 0%;
}
.result-card.anemic   .bar-fill { background: #DC2626; }
.result-card.non-anemic .bar-fill { background: #059669; }

.hb-note {
    font-size: 0.78rem;
    color: #64748B;
    font-family: 'DM Mono', monospace;
    margin-top: 8px;
}

.error-msg {
    margin-top: 16px;
    padding: 14px 18px;
    background: rgba(220,38,38,0.05);
    border: 1px solid rgba(220,38,38,0.25);
    border-radius: 10px;
    color: #DC2626;
    font-size: 0.85rem;
    display: none;
    font-family: 'DM Mono', monospace;
}

footer {
    margin-top: 40px;
    color: #64748B;
    font-size: 0.75rem;
    font-family: 'DM Mono', monospace;
    text-align: center;
    opacity: 0.6;
}

@keyframes fadeDown { from { opacity:0; transform:translateY(-16px); } to { opacity:1; transform:none; } }
@keyframes fadeUp   { from { opacity:0; transform:translateY(16px);  } to { opacity:1; transform:none; } }
@keyframes spin     { to { transform: rotate(360deg); } }
