:root {
    --brand-color: #2979ff;
    --brand-color-hover: #1565c0;
    --text-primary: #333333;
    --text-secondary: #555555;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Dynamic Background */
.background-anim {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #a1c4fd, #c2e9fb, #e0c3fc, #8ec5fc);
    background-size: 400% 400%;
    animation: gradientFlow 10s ease infinite;
    z-index: -1;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* justify-content: center; Removed to allow margins to control spacing */
    position: relative;
    padding: 20px;
    /* Add top padding to prevent overlap with guide arrow on small screens */
    padding-top: 120px; 
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Simplified Guide Styling */
.guide-container {
    position: absolute;
    top: 15px;
    right: 25px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 10;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.2s forwards;
}

.guide-arrow-static {
    width: 80px;
    height: 80px;
    margin-right: -10px;
    margin-top: -10px;
    opacity: 0.9;
}

.guide-arrow-static svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.guide-text-static {
    font-size: 14px;
    color: var(--white);
    font-weight: 500;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    margin-top: -30px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Seamless Content Styling - Removed container look */
.content {
    padding: 20px;
    text-align: center;
    width: 100%;
    max-width: 90%;
    /* Use auto margins to vertically center in available space */
    margin-top: auto;
    margin-bottom: auto;
    
    /* Initial state for transition */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.content.visible {
    opacity: 1;
    transform: translateY(0);
}

.content:hover {
    transform: none; /* Override hover transform if needed, but 'visible' sets it to 0 */
    box-shadow: none;
}

.icon-placeholder {
    margin-bottom: 24px;
    /* Add subtle drop shadow to icon itself since container is gone */
    filter: drop-shadow(0 8px 16px rgba(41, 121, 255, 0.25)); 
}

/* Ensure injected SVG icons fit well */
.icon-browser {
    width: 80px;
    height: 80px;
    display: block;
    margin: 0 auto;
}

.title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #2c3e50;
    letter-spacing: -0.5px;
    /* Add text shadow for better readability on gradient */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.subtitle {
    font-size: 14px;
    color: #505c6e;
    margin-bottom: 40px;
    line-height: 1.6;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

/* Footer Styling */
.footer {
    width: 100%;
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: rgba(50, 60, 80, 0.6);
    /* margin-top: auto; Removed to allow content to center in remaining space */
    margin-top: 0;
    padding-bottom: 30px; /* Safe area for modern phones */
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.4s forwards;
}

.footer p {
    margin: 4px 0;
}

.icp-link {
    color: inherit;
    text-decoration: none;
}

.icp-link:hover {
    text-decoration: underline;
}

/* Button Styling */
.primary-btn {
    background: linear-gradient(135deg, var(--brand-color), #1976d2); /* Subtle gradient */
    color: var(--white);
    border: none;
    padding: 14px 24px; /* Reduced padding */
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(41, 121, 255, 0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Improved spacing */
    width: 75%; /* Reduced width by 25% */
    max-width: 320px; /* Ensure it doesn't get too wide on large screens */
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.primary-btn:hover {
    box-shadow: 0 6px 20px rgba(41, 121, 255, 0.5);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(41, 121, 255, 0.3);
}

.primary-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white); /* Ensure SVG inherits this */
}

.primary-btn .icon svg {
    stroke-width: 2.5px; /* Thicker strokes for better visibility */
}

/* Toast Styling */
.toast {
    position: absolute; /* Changed from fixed to absolute */
    top: 100px; /* Position above content (content has ~120px padding-top) */
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    text-align: center;
    font-size: 14px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.checkmark {
    background: white;
    color: black;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #f7f8fa; /* Or match background gradient/color */
    display: -webkit-flex; /* Safari/Webkit */
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    text-align: center; /* Fallback for flex failure */
    z-index: 2147483647; /* Max z-index to ensure coverage */
    transition: opacity 0.4s ease-out, visibility 0.4s;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(41, 121, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--brand-color);
    animation: spin 0.8s ease-in-out infinite;
    -webkit-animation: spin 0.8s ease-in-out infinite;
    margin-bottom: 16px;
    /* Ensure spinner is centered if flex fails */
    margin-left: auto;
    margin-right: auto;
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    width: 100%;
    text-align: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Adjustments */
@media screen and (max-height: 600px) {
    .content {
        padding: 24px 20px;
        margin-top: 40px;
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    .content, .toast, .loading-overlay {
        transition: none;
    }
    .background-anim, .spinner, .guide-container, .footer {
        animation: none;
    }
    .content {
        opacity: 1;
        transform: none;
    }
    .guide-container, .footer {
        opacity: 1;
    }
}
