:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-color: #38bdf8;
    --highlight-color: #22d3ee;
    --font-family: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* CRITICAL: No scrolling */
    display: flex;
    flex-direction: column;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 90%);
}

.background-animation::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.05) 0%, transparent 50%);
    animation: rotate 60s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Burn-in protection: Micro-shift the entire container (invisible to eye, good for screen) */
@keyframes anti-burn-shift {
    0% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(1px, 1px);
    }

    100% {
        transform: translate(0, 0);
    }
}

.container {
    width: 100%;
    height: 100%;
    padding: 2vh 2vw;
    /* Use viewport units for padding */
    display: flex;
    flex-direction: column;
    animation: anti-burn-shift 300s infinite linear;
    /* Moves very slowly every 5 mins */
}

header {
    height: 14vh;
    /* Slightly taller for two lines */
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 1vw;
    margin-bottom: 2vh;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

h1 {
    font-size: 5vh;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin-bottom: 0.5vh;
}

.disclaimer {
    color: var(--accent-color);
    font-size: 2vh;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.9;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 2.5vh;
    font-weight: 300;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.5vh 1vw;
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rates-grid {
    flex: 1;
    /* Take remaining height */
    display: grid;
    /* Force 5 columns to ensure 14 items fit in 3 rows */
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 1fr;
    /* Equal height rows */
    gap: 2vh 1.5vw;
}

.rate-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 1.5vh;
    padding: 1.5vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    /* No breathing animation for cards */
}

.rate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0.4vh;
    /* Thinner line */
    background: linear-gradient(90deg, var(--accent-color), var(--highlight-color));
    opacity: 0.8;
}

/* Flag waving animation - Gentle */
@keyframes flag-wave {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-3deg);
    }

    75% {
        transform: rotate(3deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

.country-flag {
    font-size: 8vh;
    /* Scale with screen height */
    line-height: 1;
    margin-bottom: 1vh;
    filter: drop-shadow(0 0.5vh 0.5vh rgba(0, 0, 0, 0.3));
    display: inline-block;
    /* Gentle wave */
    animation: flag-wave 6s infinite ease-in-out;
    transform-origin: bottom center;
}

/* Desynchronize flags */
.rate-card:nth-child(odd) .country-flag {
    animation-delay: 0.5s;
}

.rate-card:nth-child(even) .country-flag {
    animation-delay: 1.2s;
}

.country-name {
    font-size: 2vh;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5vh;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.rate-value {
    font-size: 5vh;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.rate-currency {
    font-size: 1.8vh;
    color: var(--accent-color);
    font-weight: 600;
    margin-top: 0.5vh;
}

.loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3vh;
    color: var(--text-secondary);
    height: 100%;
}

/* Specific tweaks for 4th row if items increase to >15 */
@media (max-height: 800px) {

    /* For smaller height screens, adjust ratios slightly */
    .country-flag {
        font-size: 6vh;
    }

    .rate-value {
        font-size: 4vh;
    }
}