* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    height: -webkit-fill-available;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background-color: #000;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: auto;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.3) 100%), url('./bg.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-color: #000;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    height: 100vh;
    height: -webkit-fill-available;
    color: #333;
    line-height: 1.6;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
    touch-action: manipulation;
    overflow: hidden;
    /* Safari-specific background optimizations */
    -webkit-background-size: cover;
    -webkit-background-position: center;
    -webkit-background-repeat: no-repeat;
    /* Force hardware acceleration for better Safari performance */
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-perspective: 1000px;
    perspective: 1000px;
    /* Fallback for Safari */
    -webkit-background-clip: padding-box;
    background-clip: padding-box;
}

/* Fallback background for Safari when image fails to load */
@supports (-webkit-appearance: none) {
    body {
        /* Ensure dark overlay covers everything */
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.4) 100%);
    }
    
    /* Alternative background with image */
    body.bg-loaded {
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.3) 100%), url('./bg.jpeg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        -webkit-background-size: cover;
        -webkit-background-position: center;
        -webkit-background-repeat: no-repeat;
    }
}

/* Ensure full coverage for Safari */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.3) 100%);
    z-index: 1;
    pointer-events: none;
    /* Ensure full coverage */
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Loading state to prevent content flash */
body.loading {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.loaded {
    opacity: 1;
}

/* Ensure container covers full height */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 15px 15px 0 15px;
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 20;
    background: transparent;
    /* Force full height coverage */
    height: 100vh;
    height: -webkit-fill-available;
    /* Prevent overflow */
    overflow: hidden;
    /* Account for Safari bottom navigation bar */
    padding-bottom: 0;
}

.profile-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px 15px;
    position: relative;
    z-index: 15;
    /* Reduce padding to fit in viewport */
    flex-shrink: 0;
}

.profile-image {
    margin-bottom: 15px;
}

.profile-image img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    touch-action: manipulation;
    pointer-events: auto;
}

.profile-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.profile-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.profile-bio {
    font-size: 1rem;
    color: white;
    font-weight: 400;
    max-width: 400px;
    margin: 0 auto;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.links-section {
    flex: 1;
    margin-bottom: 0;
    /* Ensure it fits in remaining space */
    min-height: 0;
    overflow: hidden;
    /* Remove bottom padding to prevent Safari UI overlap */
    padding-bottom: 0;
}

.links-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Reduce gap to fit more content */
    height: 100%;
    overflow-y: auto;
    /* Add smooth scrolling for links if needed */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    /* Ensure content fits above Safari UI */
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Hide scrollbar for webkit browsers */
.links-container::-webkit-scrollbar {
    display: none;
}

.link-button {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 14px 18px;
    text-decoration: none;
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 20;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    /* Reduce padding to fit more content */
    flex-shrink: 0;
}

.link-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.link-button:hover::before {
    left: 100%;
}

.link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 1);
}

.link-button:active {
    transform: translateY(0);
}

.link-button .link-title {
    font-weight: 600;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .profile-section {
        padding: 15px 15px;
        margin-bottom: 30px;
    }
    
    .profile-name {
        font-size: 1.6rem;
    }
    
    .profile-bio {
        font-size: 0.95rem;
    }
    
    .link-button {
        padding: 14px 18px;
        font-size: 0.95rem;
        border-radius: 14px;
    }
    
    .links-container {
        gap: 10px;
    }
    
    .links-section {
        padding-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .profile-name {
        font-size: 1.4rem;
    }
    
    .profile-bio {
        font-size: 0.9rem;
    }
    
    .link-button {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .links-container {
        gap: 8px;
    }
    
    .profile-section {
        margin-bottom: 25px;
    }
    
    .links-section {
        padding-bottom: 10px;
    }
}

/* CSS Custom Properties for dynamic viewport handling */
:root {
    --vh: 1vh;
    --dvh: 1dvh;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    html {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
        /* Prevent zooming on iOS */
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
        /* Prevent iOS Safari from zooming background */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        /* Force font size to prevent system scaling */
        font-size: 16px;
        -webkit-font-size: 16px;
    }
    
    body {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
        /* Safari-specific background fixes */
        -webkit-background-clip: border-box;
        background-clip: border-box;
        /* Prevent background zooming on iOS */
        background-attachment: scroll;
        -webkit-background-attachment: scroll;
        /* iOS-specific optimizations */
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
        /* Prevent momentum scrolling issues */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        /* Completely disable background on iOS to prevent movement */
        background-image: none !important;
        -webkit-background-image: none !important;
        /* Force font size to prevent system scaling */
        font-size: 16px;
        -webkit-font-size: 16px;
        /* Prevent iOS font scaling */
        -webkit-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    /* Use pseudo-element for background on iOS to prevent movement */
    body::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: calc(var(--vh, 1vh) * 100);
        height: calc(var(--dvh, 1dvh) * 100);
        height: 100vh;
        height: 100dvh;
        height: -webkit-fill-available;
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.3) 100%), url('./bg.jpeg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        -webkit-background-size: cover;
        -webkit-background-position: center;
        -webkit-background-repeat: no-repeat;
        z-index: -1;
        pointer-events: none;
        /* Prevent iOS movement */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: auto;
        /* Use viewport units that handle dynamic changes */
        min-height: 100vh;
        min-height: 100dvh;
        min-height: -webkit-fill-available;
    }
    
    .container {
        min-height: -webkit-fill-available;
        height: -webkit-fill-available;
        /* Prevent iOS zoom issues */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        /* Force font size to prevent system scaling */
        font-size: 16px;
        -webkit-font-size: 16px;
    }
    
    /* Fix for Safari background rendering order */
    body::before {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
        /* Prevent iOS zoom issues */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Force consistent font sizes on iOS */
    .profile-name {
        font-size: 1.6rem !important;
        -webkit-font-size: 1.6rem !important;
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    .profile-bio {
        font-size: 0.9rem !important;
        -webkit-font-size: 0.9rem !important;
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    .link-button {
        font-size: 0.9rem !important;
        -webkit-font-size: 0.9rem !important;
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
        /* Ensure buttons fit properly */
        padding: 12px 16px !important;
        -webkit-padding: 12px 16px !important;
    }
}

/* Android Chrome specific fixes */
@supports (height: 100dvh) {
    html {
        height: 100dvh;
        min-height: 100dvh;
    }
    
    body {
        height: 100dvh;
        min-height: 100dvh;
    }
    
    .container {
        min-height: 100dvh;
        height: 100dvh;
    }
    
    body::before {
        height: 100dvh;
        min-height: 100dvh;
    }
}

/* Additional Safari optimizations */
@supports (-webkit-appearance: none) {
    body {
        /* Force Safari to render background properly */
        -webkit-background-size: cover !important;
        background-size: cover !important;
        /* Prevent Safari from showing background before content */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        /* Ensure full height coverage in Safari */
        height: 100vh;
        height: -webkit-fill-available;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        /* Prevent iOS zoom issues */
        background-attachment: scroll;
        -webkit-background-attachment: scroll;
    }
    
    /* Ensure overlay covers everything in Safari */
    body::before {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
        /* Force full coverage in Safari */
        height: 100vh !important;
        height: -webkit-fill-available !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        /* Prevent iOS zoom issues */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Force container to full height in Safari */
    .container {
        height: 100vh !important;
        height: -webkit-fill-available !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        /* Prevent iOS zoom issues */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Ensure html element covers full height in Safari */
    html {
        height: 100vh !important;
        height: -webkit-fill-available !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        /* Prevent iOS zoom issues */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* iOS-specific background fixes */
@supports (-webkit-touch-callout: none) and (max-width: 1024px) {
    body {
        /* Prevent iOS background zooming */
        background-attachment: scroll !important;
        -webkit-background-attachment: scroll !important;
        /* Ensure full height coverage */
        height: 100vh !important;
        height: -webkit-fill-available !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        /* Prevent iOS momentum scrolling issues */
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
        /* Completely disable background image on iOS to prevent movement */
        background-image: none !important;
        -webkit-background-image: none !important;
    }
    
    /* Use pseudo-element for background on iOS to prevent movement */
    body::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        height: 100vh;
        height: -webkit-fill-available;
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.3) 100%), url('./bg.jpeg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        -webkit-background-size: cover;
        -webkit-background-position: center;
        -webkit-background-repeat: no-repeat;
        z-index: -1;
        pointer-events: none;
        /* Prevent iOS movement */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: auto;
    }
    
    /* Ensure full height coverage on iOS */
    html, body, .container {
        height: 100vh !important;
        height: -webkit-fill-available !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
    }
}

/* Additional iOS Safari fixes to prevent background movement */
@supports (-webkit-touch-callout: none) {
    /* Force static background on iOS */
    html, body {
        background-attachment: local !important;
        -webkit-background-attachment: local !important;
        background-position: center !important;
        -webkit-background-position: center !important;
        /* Prevent any background movement */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-perspective: 1000;
        perspective: 1000;
    }
    
    /* Ensure pseudo-element background is completely static */
    body::after {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        height: calc(var(--dvh, 1dvh) * 100) !important;
        height: 100vh !important;
        height: 100dvh !important;
        height: -webkit-fill-available !important;
        /* Prevent any movement */
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
        will-change: auto !important;
        /* Ensure background stays in place */
        background-attachment: fixed !important;
        -webkit-background-attachment: fixed !important;
        /* Smooth transitions for viewport changes */
        transition: height 0.1s ease-out;
        -webkit-transition: height 0.1s ease-out;
    }
}

/* Animation for page load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-section,
.links-container {
    animation: fadeInUp 0.8s ease-out;
}

.links-container {
    animation-delay: 0.2s;
}

/* iPhone 16 specific optimizations */
@media screen and (device-width: 393px) and (device-height: 852px),
       screen and (device-width: 852px) and (device-height: 393px) {
    .container {
        padding: 12px 12px 0 12px;
    }
    
    .profile-section {
        margin-bottom: 25px;
        padding: 12px 12px;
    }
    
    .profile-image img {
        width: 90px;
        height: 90px;
    }
    
    .profile-name {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }
    
    .profile-bio {
        font-size: 0.85rem;
    }
    
    .link-button {
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 14px;
    }
    
    .links-container {
        gap: 8px;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    
    .links-section {
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

/* Additional iOS device optimizations */
@supports (-webkit-touch-callout: none) {
    /* Ensure all content fits on iOS devices */
    .container {
        padding: 12px 12px 0 12px;
        height: 100vh;
        height: -webkit-fill-available;
        height: 100dvh;
        /* Remove bottom padding for Safari UI */
        padding-bottom: 0;
    }
    
    .profile-section {
        margin-bottom: 25px;
        padding: 12px 12px;
    }
    
    .links-section {
        padding-bottom: 0;
        margin-bottom: 0;
    }
    
    .links-container {
        gap: 8px;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

/* Account for Safari bottom navigation bar */
@supports (-webkit-touch-callout: none) {
    /* Use safe-area-inset-bottom to account for Safari UI */
    .container {
        padding-bottom: env(safe-area-inset-bottom);
        padding-bottom: constant(safe-area-inset-bottom);
    }
    
    /* Ensure links container doesn't overlap Safari UI */
    .links-container {
        /* Reserve space for Safari bottom navigation bar */
        margin-bottom: env(safe-area-inset-bottom);
        margin-bottom: constant(safe-area-inset-bottom);
        /* Alternative approach - use calc to subtract Safari UI height */
        height: calc(100% - env(safe-area-inset-bottom));
        height: calc(100% - constant(safe-area-inset-bottom));
    }
}

/* Fallback for devices without safe-area-inset support */
@supports not (padding-bottom: env(safe-area-inset-bottom)) {
    .container {
        padding-bottom: 0;
    }
    
    .links-container {
        margin-bottom: 0;
        height: 100%;
    }
}


