:root{
    --bg-top: #0f172a;
    --bg-bottom: #1d4ed8;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-border: rgba(148, 163, 184, 0.28);
    --text-main: #0f172a;
    --text-soft: #475569;
    --text-faint: #64748b;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #ccfbf1;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.28);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.14);
}

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

body{
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at top left, rgba(45, 212, 191, 0.32), transparent 28%),
        radial-gradient(circle at bottom right, rgba(191, 219, 254, 0.32), transparent 30%),
        linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
}

.app-shell{
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 2vw, 2rem);
}

.con{
    width: min(100%, 48rem);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    padding: clamp(1.35rem, 2vw, 2rem);
    border-radius: 1.5rem;
    animation: reveal .35s ease-out;
}

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

.hero{
    margin-bottom: 1.5rem;
}

.eyebrow{
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero h1{
    font-size: clamp(1.9rem, 4vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.subtext{
    color: var(--text-soft);
    line-height: 1.5;
}

form{
    display: grid;
    gap: 1rem;
}

label{
    font-size: 0.95rem;
    font-weight: 600;
}

.label-row{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.55rem;
}

input,
select,
button{
    width: 100%;
    border: none;
    outline: none;
    border-radius: 0.95rem;
    font: inherit;
}

input,
select{
    background: #fff;
}

input{
    border: 1px solid #dbe2ea;
    font-size: 1.4rem;
    font-weight: 700;
    height: 3.4rem;
    padding: 0 1rem;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input:focus,
select:focus{
    border-color: #2dd4bf;
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18);
}

.field-hint{
    margin-top: 0.45rem;
    font-size: 0.85rem;
    color: var(--text-faint);
}

.quick-amounts{
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chip,
.ghost-btn{
    width: auto;
    cursor: pointer;
    transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}

.chip{
    padding: 0.65rem 0.9rem;
    background: #eef6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
    font-weight: 600;
}

.chip:hover,
.ghost-btn:hover,
.swap-btn:hover{
    transform: translateY(-1px);
}

.ghost-btn{
    padding: 0.55rem 0.8rem;
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--text-soft);
}

.dropdown{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 1rem;
    align-items: end;
}

.from,
.to{
    min-width: 0;
}

.select{
    margin-top: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-radius: 1rem;
    border: 1px solid #dbe2ea;
    background: #fff;
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-md);
}

.select img{
    width: 2rem;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: cover;
    border-radius: 0.35rem;
    flex-shrink: 0;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.select img.is-placeholder,
.compare-select-wrap img.is-placeholder{
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 0.12rem;
}

select{
    min-width: 0;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.98rem;
}

.swap-btn{
    width: 3rem;
    height: 3rem;
    align-self: center;
    background: var(--brand-soft);
    color: var(--brand-dark);
    border: 1px solid rgba(15, 118, 110, 0.18);
    cursor: pointer;
}

.stats{
    display: grid;
    gap: 0.8rem;
}

.stat-card,
.mini-stat{
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1rem;
}

.stat-grid{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.stat-label{
    color: var(--text-faint);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.msg{
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.3;
}

.unit-rate,
.inverse-rate,
.status{
    color: var(--text-soft);
    line-height: 1.45;
}

.status{
    min-height: 1.5rem;
    font-size: 0.92rem;
}

.status.is-error{
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid rgba(185, 28, 28, 0.12);
    padding: 0.75rem 0.9rem;
    border-radius: 0.9rem;
}

.status.is-success{
    color: var(--brand-dark);
}

.compare-section{
    display: grid;
    gap: 0.7rem;
}

.compare-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
}

.compare-count{
    color: var(--text-soft);
    font-size: 0.92rem;
}

.add-compare-btn{
    width: auto;
    padding: 0.6rem 0.9rem;
    background: #e0f2fe;
    color: #0c4a6e;
    border: 1px solid #bae6fd;
    cursor: pointer;
    font-weight: 600;
    transition: transform .18s ease, background-color .18s ease;
}

.add-compare-btn:hover{
    transform: translateY(-1px);
    background: #dbeafe;
}

.compare-list{
    display: grid;
    gap: 0.6rem;
}

.compare-row{
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
    gap: 0.6rem;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.7rem;
}

.compare-select-wrap{
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid #dbe2ea;
    border-radius: 0.8rem;
    background: #fff;
    padding: 0 0.65rem;
    min-height: 2.7rem;
}

.compare-select-wrap img{
    width: 1.8rem;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: cover;
    border-radius: 0.3rem;
    flex-shrink: 0;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.compare-row select{
    background: transparent;
    border: none;
    height: 2.5rem;
    padding: 0;
}

.compare-result{
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.35;
}

.compare-result.is-error{
    color: var(--danger);
}

.remove-compare-btn{
    width: auto;
    min-width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
}

@media (max-width: 860px){
    .dropdown{
        grid-template-columns: 1fr;
    }

    .swap-btn{
        width: 100%;
        height: 2.9rem;
    }
}

@media (max-width: 680px){
    .con{
        padding: 1.35rem;
        border-radius: 1.2rem;
    }

    .stat-grid{
        grid-template-columns: 1fr;
    }

    .label-row{
        align-items: flex-start;
        flex-direction: column;
        gap: 0.55rem;
    }

    .compare-header{
        flex-direction: column;
        align-items: flex-start;
    }

    .compare-row{
        grid-template-columns: 1fr;
    }

    .remove-compare-btn{
        width: 100%;
        border-radius: 0.8rem;
    }
}
