:root {
    --accent: #ff4757;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --card-bg: #ffffff;
    --text-dark: #1e272e;
    --text-muted: #4b5563;
    --bg-dark: #0a0f1e;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    margin: 0; 
    min-height: 100vh; 
    font-family: 'Inter', sans-serif;
    color: white; 
    background: var(--bg-dark); 
    overflow-x: hidden;
}

/* --- Animated Aurora Background --- */
.background-animate {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: -1;
    background: linear-gradient(135deg, #0a0f1e 0%, #1a2a6c 30%, #b21f1f 70%, #fdbb2d 100%);
    background-size: 400% 400%; 
    animation: gradientShift 15s ease infinite; 
    opacity: 0.5;
}

@keyframes gradientShift { 
    0% { background-position: 0% 50%; } 
    50% { background-position: 100% 50%; } 
    100% { background-position: 0% 50%; } 
}

.container { 
    width: 92%; 
    max-width: 800px; 
    margin: 0 auto; 
    padding: 60px 0; 
}

/* --- Header & Logo --- */
header { 
    text-align: center; 
    margin-bottom: 40px; 
}

.logo-wrapper { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 12px; 
}

.main-flag { 
    width: 35px; 
    border-radius: 3px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
}

.subtitle { 
    opacity: 0.8; 
    font-size: 0.95rem; 
    margin-top: 5px; 
}

.header-instructions {
    margin: 8px auto;
    background: rgba(255, 255, 255, 0.05); /* Very subtle glass effect */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px 16px;
    width: fit-content;
    backdrop-filter: blur(8px);
}

.instruction-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
}

.instruction-steps {
    display: flex;
    flex-direction: column; /* Stacks vertically so no horizontal scroll */
    gap: 2px;
}

.instruction-steps span {
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    display: block;
    line-height: 1.4;
}

.header-disclaimer {
    font-size: 0.6rem;
    opacity: 0.5;
    margin-bottom: 5px;
    text-align: center;
}

/* --- Navigation --- */
.button-group { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 12px; 
    margin-bottom: 25px; 
    
    /* Stick to top */
    position: -webkit-sticky;
    position: relative;
    top: 10px; 
    z-index: 1000;
    
    /* Premium Glassmorphism (No more solid black) */
    background: rgba(255, 255, 255, 0.03); /* Nearly transparent */
    backdrop-filter: blur(15px); /* Strong blur for readability */
    -webkit-backdrop-filter: blur(15px);
    padding: 10px;
    border-radius: 20px;
    
    /* Subtle border to define the shape against the aurora */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.button-group.sticky-active {
    position: -webkit-sticky;
    position: sticky;
    top: 10px;
    z-index: 1000;
}

.category-btn {
    background: var(--glass); 
    border: 1px solid var(--glass-border); 
    padding: 20px 8px;
    border-radius: 18px; 
    color: white; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 6px;
}

.category-btn.active { 
    background: white; 
    color: var(--bg-dark); 
    transform: translateY(-2px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.2); 
}

.category-btn .icon {
    font-size: 1.6rem;
}

/* --- Warning Alerts --- */
.alert-warning {
    position: -webkit-sticky;
    position: sticky;
    top: 95px; /* Aligned under your sticky buttons */
    z-index: 2000;
    
    /* Matching your Glassmorphism theme */
    background: rgba(255, 255, 255, 0.08) !important; 
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    /* Refined Border & Shadow */
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    /* Typography */
    color: #ffffff !important;
    padding: 16px;
    border-radius: 20px;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.4;
    font-weight: 500;
    margin: 15px auto;
    width: 92%;
    
    /* Clean state - No bobbling/animations */
    animation: none !important;
    transition: all 0.3s ease;
}

/* Make the specific 'Open in Browser' text pop without being 'ugly' */
.alert-warning b {
    color: var(--accent); /* Uses your #ff4757 for the call-to-action only */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Global Hidden State */
.hidden { 
    display: none !important; 
}

/* --- Grid & Cards --- */
.results-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 25px; 
}

.card { 
    display: flex;
    flex-direction: column;
    background: var(--card-bg); 
    border-radius: 24px; 
    overflow: hidden; 
    color: var(--text-dark); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.3); 
    animation: slideUp 0.4s ease-out;
     height: auto;
}

@keyframes slideUp { 
    from { opacity: 0; transform: translateY(15px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.img-container { 
    height: 210px; 
    position: relative; 
    background: #f0f0f0; 
    overflow: hidden;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dist-tag {
    position: absolute; 
    top: 12px; 
    right: 12px; 
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px); 
    color: white; 
    padding: 6px 12px; 
    border-radius: 50px;
    font-size: 0.75rem; 
    font-weight: 700; 
    border: 1px solid rgba(255,255,255,0.1);
}

.card-content { 
    padding: 24px; 
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.category-tag { 
    color: var(--accent); 
    font-size: 0.75rem; 
    font-weight: 800; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.card-content h3 { 
    margin: 8px 0; 
    font-family: 'Poppins', sans-serif; 
    font-size: 1.3rem; 
    letter-spacing: -0.5px; 
}

.card-content p {
    font-size: 0.75rem;
    line-height: 1.4;
    overflow: visible;
    display: block;
}

.card-footer {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Space between buttons if you add more */
}

.btn-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
}

.btn-link:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.btn-link:active {
    transform: translateY(0);
}

.btn-share-secondary {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: var(--text-dark) !important;
}

.btn-share-secondary:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 60px 0 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 50px;
}

footer p { 
    font-size: 0.85rem; 
    opacity: 0.5; 
    margin-bottom: 12px; 
}

.footer-legal p { 
    font-size: 0.7rem; 
    opacity: 0.4; 
    line-height: 1.5; 
    max-width: 450px; 
    margin: 0 auto; 
}

.footer-legal a { 
    color: white; 
    text-decoration: underline; 
}

/* --- Tutorial Overlay (Universal Fix) --- */
#tutorial-overlay {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background: rgba(10, 15, 30, 0.95);
    z-index: 99999; /* Ensure it covers everything including headers */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#tutorial-overlay.hidden { 
    display: none !important; 
}

.tutorial-content {
    width: 90%;
    max-width: 400px;
    padding: 30px;
    text-align: center;
    color: white;
    animation: slideUp 0.5s ease-out;
}

.tutorial-arrow {
    font-size: 2rem;
    margin: 10px 0;
    animation: bounce 2s infinite ease-in-out;
}

.tutorial-close {
    margin-top: 30px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 10px 20px rgba(255, 71, 87, 0.3);
}

@keyframes bounce { 
    0%, 100% { transform: translateY(0); } 
    50% { transform: translateY(-15px); } 
}

/* --- Responsive Breakpoints --- */
@media (max-width: 500px) {
    .results-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* Force side-by-side */
        gap: 10px !important;
        padding: 5px !important;
    }

    .card {
        flex-direction: column !important; /* Stacks image on top of text inside the half-width card */
        height: auto !important; 
        min-height: 280px;
        margin: 0 !important;
    }

    .img-container {
        width: 100% !important;
        height: 110px !important;
    }

    .card-content {
        padding: 24px; 
        display: flex;
        flex-direction: column;
        flex-grow: 1;
    }

    .card-content h3 { 
        font-size: 0.85rem !important; 
        margin: 4px 0 !important; 
        line-height: 1.2;
    }
    
    .card-content p { 
        font-size: 0.75rem !important; 
        margin-bottom: 8px !important;
        line-height: 1.4;
    }

    .card-footer { 
        padding-top: 5px !important; 
        gap: 4px !important; 
    }

    .btn-link { 
        padding: 8px 4px !important; 
        font-size: 0.65rem !important; 
    }

    .dist-tag { 
        font-size: 0.6rem !important; 
        padding: 2px 6px !important; 
        top: 6px !important; 
        right: 6px !important; 
    }
}

@media (min-width: 1024px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 30, 0.7); /* Darker overlay to make loader pop */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* Above everything */
    transition: opacity 0.5s ease;
}

.loader-content {
    text-align: center;
    color: white;
}

.pulse-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent), #fdbb2d);
    position: relative;
    animation: pulse 2s infinite ease-in-out;
    box-shadow: 0 0 30px rgba(255, 71, 87, 0.5);
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
    50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 40px 10px rgba(255, 71, 87, 0); }
    100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.loader-content p {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 1rem;
}

.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: white; /* Contrast against the dark background */
    color: var(--text-dark);
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: slideUpToast 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

@keyframes slideUpToast {
    from { bottom: -100px; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}

.toast-icon { font-size: 1.2rem; }
.toast-text { font-size: 0.9rem; font-weight: 700; }

/* Desktop adjustment for toast */
@media (max-width: 500px) {
    .toast-notification {
        width: 90%;
        font-size: 0.8rem;
        bottom: 20px;
    }
    .toast-text { font-size: 0.8rem; }
}

.hero-transition {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
    padding: 20px;
}

.hero-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px 30px;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: heroPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-icon { font-size: 3rem; margin-bottom: 15px; }

.hero-card h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    line-height: 1.5; /* Prevents text from being squeezed */
    margin-bottom: 20px;
}

.hero-loader {
    height: 3px;
    width: 100px;
    background: rgba(255,255,255,0.1);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.hero-loader::after {
    content: '';
    position: absolute;
    left: -100%;
    height: 100%;
    width: 100%;
    background: var(--accent);
    animation: loadingHero 1s linear forwards;
}

@keyframes heroPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes loadingHero {
    to { left: 0; }
}

.fade-out { opacity: 0; pointer-events: none; }

@keyframes heroMoment {
    0% { opacity: 0; transform: scale(1.05); }
    15% { opacity: 1; transform: scale(1); }
    85% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.98); }
}

.hero-transition h2 { 
    font-family: 'Poppins', sans-serif;
    font-size: 2.2rem; 
    margin-bottom: 12px;
    background: linear-gradient(to right, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-transition p { 
    font-size: 1.1rem;
    font-weight: 500; 
    opacity: 0.9;
    max-width: 320px;   /* fixed width instead of % */
    margin: 0 auto;     /* 🔥 forces true centering */
    text-align: center; /* ensures alignment */
}

.fab-share {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: white;
    color: var(--text-dark);
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 800;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    z-index: 9999;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid var(--accent);
    transition: transform 0.2s;
}

.fab-share:active { transform: scale(0.9); }

/* Hide FAB when loading overlay is active to keep it clean */
.loader-container:not(.hidden) ~ #app-share-fab {
    display: none;
}
