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

:root {
    /* Color variables are injected by server from .env file */
    /* Default values below are fallbacks if .env is not configured */
    --primary-color: #000000;
    --primary-dark: #000000;
    --secondary-color: #ffffff;
    --text-color: #333333;
    --text-light: #666;
    --bg-color: #000000;
    --button-color: #c21a17;
    --button-active-color: #aa1917;
    --button-text-color: #ffffff;
    --white: #ffffff;
    --player-card-background: #ffffff;
    --spinner-base-color: #ffffff33;
    --spinner-active-color: #c21a17;
    --camera-btn-background-color: #c21a17;
    --camera-btn-icon-color: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

html, body {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

.page {
    display: none;
    flex: 1;
    overflow: hidden;
    padding: 15px;
    padding-bottom: 140px;
    height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: var(--bg-color);
    will-change: transform, opacity;
    align-items: flex-start;
    justify-content: flex-start;
}

.page.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateX(0);
    position: absolute;
    top: 0;
    z-index: 1;
    isolation: isolate;
    align-items: flex-start;
    justify-content: flex-start;
}

.page.exiting {
    transform: translateX(-100%);
    opacity: 0;
    position: absolute;
    top: 0;
}

.page.entering {
    opacity: 0;
    transform: translateX(100%);
    position: absolute;
    top: 0;
}

.page.entering.active {
    opacity: 1;
    transform: translateX(0);
    position: absolute;
    top: 0;
}

/* Ensure onboarding-content and userinfo-content blur is visible from the start, before animation */
/* The blur must be applied before the page becomes visible */
#onboarding-page .onboarding-content,
#userinfo-page .userinfo-content {
    /* Blur is always applied, even when page is not visible yet */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.2);
    /* Ensure it renders even when parent has opacity 0 */
    opacity: 1;
    /* Force rendering layer */
    will-change: backdrop-filter;
    transform: translateZ(0);
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    flex: 1;
    padding: 10px;
    padding-bottom: 0;
    overflow: hidden;
    min-height: 0;
    position: relative;
    height: 100%;
    box-sizing: border-box;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Step Indicator */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.step-indicator .step-number {
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

/* Hide step indicator on landing page (it's step 1 but doesn't need to show) */
#landing-page .step-indicator {
    display: none;
}

#landing-page {
    background-image: url('https://amplifi-selfie-cam.s3.ca-central-1.amazonaws.com/background/hexagoncup-background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    background-color: var(--bg-color);
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

#landing-page.image-loaded {
    opacity: 1;
}

.landing-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
}

#landing-page.image-loaded .landing-page-loader {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.landing-page-loader .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--spinner-base-color);
    border-top-color: var(--spinner-active-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#landing-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 20%, rgba(0, 0, 0, 0.5) 40%, rgba(0, 0, 0, 0) 50%);
    z-index: 0;
}

#landing-page .container {
    position: relative;
    z-index: 1;
    justify-content: center;
    align-items: center;
    padding: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: 40vh;
}

/* Burger Menu - only visible on landing page */
.burger-menu {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1002;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#landing-page.active .burger-menu {
    display: flex;
}

.burger-menu:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.05);
}

.burger-menu:active {
    transform: scale(0.95);
}

.burger-menu i {
    color: var(--white);
    font-size: 20px;
}

.burger-menu-dropdown {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: none;
}

#landing-page.active .burger-menu-dropdown {
    display: block;
}

.burger-menu-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.burger-menu-item {
    display: block;
    width: 100%;
    padding: 16px 20px;
    color: var(--white);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.burger-menu-item:last-child {
    border-bottom: none;
}

.burger-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.burger-menu-item:active {
    background: rgba(255, 255, 255, 0.15);
}

.burger-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: none;
}

#landing-page.active .burger-menu-overlay {
    display: block;
}

.burger-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#onboarding-page {
    background-image: url('https://amplifi-selfie-cam.s3.ca-central-1.amazonaws.com/background/hexagoncup-background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    background-color: var(--bg-color);
}

#onboarding-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 20%, rgba(0, 0, 0, 0.5) 40%, rgba(0, 0, 0, 0) 50%);
    z-index: 0;
}

#onboarding-page .container {
    position: relative;
    z-index: 1;
    align-items: center;
    justify-content: center;
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.landing-title {
    text-align: center;
    margin-bottom: 0;
    animation: fadeInUp 0.8s ease-out;
    opacity: 0;
    animation-fill-mode: forwards;
}

.landing-title h1 {
    color: var(--white);
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0;
}

/* Base CTA container - unified styling for all CTA buttons */
.cta-container {
    position: fixed;
    bottom: max(68px, calc(60px + env(safe-area-inset-bottom) + 8px));
    left: 50%;
    transform: translateX(150%);
    width: 100%;
    max-width: 100%;
    padding: 0 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    z-index: 1001;
    pointer-events: auto;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* CTA container when visible - slides in from right */
.cta-container.visible,
.page.active .cta-container {
    transform: translateX(-50%);
    opacity: 1;
}

/* Hide CTA containers on inactive pages to prevent them appearing during transitions */
.page:not(.active) .cta-container {
    display: none;
}

/* Landing page CTA - uses same base styles as .cta-container */
#landing-page-cta {
    display: none;
    opacity: 0;
    transform: translateX(150%);
    z-index: 1002;
    pointer-events: none;
}

/* Show when visible class is added - slides in from right */
#landing-page-cta.visible {
    display: flex !important;
    transform: translateX(-50%);
    opacity: 1;
}

/* Terms page CTA - uses same base styles as .cta-container, outside page container */
#terms-page-cta {
    display: none;
}

/* Show when visible class is added - slides in from right */
#terms-page-cta.visible {
    display: flex !important;
    transform: translateX(-50%);
    opacity: 1;
}

/* Onboarding page CTA - uses same base styles as .cta-container */
#onboarding-page-cta {
    display: none;
}

/* Show when visible class is added - slides in from right */
#onboarding-page-cta.visible {
    display: flex !important;
    transform: translateX(-50%);
    opacity: 1;
}

/* User Info page CTA - uses same base styles as .cta-container */
#userinfo-page-cta {
    display: none;
}

/* Show when visible class is added - slides in from right */
#userinfo-page-cta.visible {
    display: flex !important;
    transform: translateX(-50%);
    opacity: 1;
}

/* User Info Form Styles */
#userinfo-page {
    background-image: url('https://amplifi-selfie-cam.s3.ca-central-1.amazonaws.com/background/hexagoncup-background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    background-color: var(--bg-color);
}

#userinfo-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 20%, rgba(0, 0, 0, 0.5) 40%, rgba(0, 0, 0, 0) 50%);
    z-index: 0;
}

#userinfo-page .container {
    position: relative;
    z-index: 1;
    align-items: center;
    justify-content: center;
    padding: 4px 20px;
    max-width: 500px;
    margin: 0 auto;
}

#userinfo-page .page-title {
    color: var(--white);
    font-size: 22px;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Shared glassmorphism container style */
.userinfo-content,
.onboarding-content {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px 15px 15px 15px;
    margin-bottom: 12vh;
    flex: 0 1 auto;
    overflow: visible;
    width: 100%;
    max-height: calc(100vh - 200px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Ensure blur is applied immediately, even during page transitions */
    will-change: backdrop-filter;
    transform: translateZ(0); /* Force hardware acceleration */
}

.userinfo-content {
    max-height: calc(100vh - 200px);
}

/* onboarding-content base styles are in shared glassmorphism section above */
.onboarding-content {
    text-align: center;
    color: var(--white);
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

.userinfo-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.form-group input {
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: var(--white);
    color: var(--primary-color);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus {
    outline: none;
    border-color: var(--button-color);
    background: var(--white);
}

.form-group input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: var(--button-active-color);
    background: var(--white);
}

.form-group input:valid:not(:placeholder-shown) {
    border-color: #e0e0e0;
    background: var(--white);
}

.error-message {
    color: var(--button-active-color);
    font-size: 12px;
    min-height: 16px;
    display: block;
    padding: 4px 0;
}

@media (max-width: 480px) {
    #userinfo-page .container {
        padding: 4px 12px;
    }
    
    #userinfo-page .page-title {
        color: var(--white);
        font-size: 20px;
        margin-bottom: 12px;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .userinfo-content {
        padding: 12px;
        margin-bottom: 12vh;
    }
    
    .userinfo-form {
        gap: 10px;
    }
    
    .form-group {
        gap: 5px;
    }
    
    .form-group input {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-group label {
        font-size: 12px;
    }
    
    .error-message {
        font-size: 11px;
        min-height: 14px;
        padding: 4px 0;
    }
}

/* Album share button - uses same base styles as .cta-container */
#album-cta-container {
    display: none;
}

/* Show when visible class is added - slides in from right */
#album-cta-container.visible {
    display: flex !important;
    transform: translateX(-50%);
    opacity: 1;
}

.cta-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 280px;
    text-align: center;
    flex-shrink: 0;
    background: var(--button-color);
    color: var(--button-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    outline: none;
}

.cta-btn:focus {
    outline: none;
    box-shadow: var(--shadow);
}

.cta-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: var(--button-active-color);
}

.cta-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.cta-btn:disabled:active {
    transform: none;
}

.cta-btn i {
    font-size: 18px;
    color: var(--white);
}

.btn-secondary {
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 280px;
    text-align: center;
    flex-shrink: 0;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-secondary:active {
    transform: scale(0.95);
}

#camera-cta {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 100%;
    padding: 0 20px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

#camera-cta .cta-btn,
#camera-cta .btn-secondary {
    max-width: 135px;
    flex: 1;
}

#terms-page {
    background-image: url('https://amplifi-selfie-cam.s3.ca-central-1.amazonaws.com/background/hexagoncup-background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    background-color: var(--bg-color);
}

#terms-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 20%, rgba(0, 0, 0, 0.5) 40%, rgba(0, 0, 0, 0) 50%);
    z-index: 0;
}

#terms-page .container {
    position: relative;
    z-index: 1;
    max-width: 500px;
    margin: 0 auto;
}

.terms-title {
    color: var(--primary-color);
    margin: 0 0 15px 0;
    padding: 0 0 15px 0;
    font-size: 22px;
    text-align: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.terms-content {
    background: var(--white);
    border-radius: 15px;
    padding: 20px 15px 15px 15px;
    margin-bottom: 12vh;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100vh - 200px);
}

.terms-scrollable {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    min-height: 0;
}


.terms-scrollable::-webkit-scrollbar {
    width: 6px;
}

.terms-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.terms-scrollable::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.terms-scrollable h2 {
    color: var(--primary-color);
    font-size: 16px;
    margin-top: 15px;
    margin-bottom: 8px;
}

.terms-scrollable p {
    color: var(--primary-color);
    line-height: 1.5;
    margin-bottom: 10px;
    font-size: 13px;
}

/* onboarding-content styles are now in the shared glassmorphism section above */

.onboarding-icon {
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
    flex-shrink: 0;
}

.onboarding-icon svg {
    width: 80px;
    height: 80px;
}

.onboarding-content h1 {
    color: var(--white);
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
    flex-shrink: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.instructions {
    text-align: left;
    max-width: 280px;
    margin: 0 auto;
    flex-shrink: 0;
}

.instruction-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    color: var(--white);
    gap: 15px;
}

.instruction-item p {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.step-number {
    background: var(--white);
    color: var(--primary-color);
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    flex-shrink: 0;
}

.instruction-item p {
    flex: 1;
    line-height: 1.4;
    font-size: 14px;
    margin: 0;
    display: flex;
    align-items: center;
}

#camera-page {
    padding: 0;
    padding-bottom: 60px;
}

#camera-page .image-container {
    margin-bottom: 0;
}

/* Shimmer effect for camera video while loading */
.camera-container.loading {
    position: relative;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: shimmerBackground 2s infinite;
    overflow: hidden;
}

.camera-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 1.5s infinite;
    z-index: 1;
    pointer-events: none;
}

.camera-container.loading video {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.camera-container:not(.loading) video {
    opacity: 1;
}

#camera-page .container {
    min-height: 0;
    max-height: none;
    overflow: visible;
    justify-content: space-between;
    padding: 0;
    width: 100%;
    flex: 1;
    position: relative;
    gap: 0;
}

.image-container {
    width: 100%;
    max-width: 100%;
    position: relative;
    background: var(--bg-color);
    border-radius: 0;
    overflow: hidden;
    aspect-ratio: 4/5;
    margin: 0;
    margin-bottom: 0;
    padding: 0;
    flex-shrink: 0;
    flex: 0 0 auto;
    min-height: 0;
}


#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#preview-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
}

#preview-image {
    width: 100%;
    height: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
}

.camera-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 0;
}

.camera-error-content {
    text-align: center;
    padding: 30px 20px;
    color: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.camera-error-content i {
    font-size: 48px;
    color: var(--white);
    opacity: 0.8;
}

.camera-error-content p {
    font-size: 16px;
    color: var(--white);
    margin: 0;
    line-height: 1.5;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--white);
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--spinner-base-color);
    border-top-color: var(--spinner-active-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.camera-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0; /* Remove margins to allow centering */
    flex-shrink: 0;
    padding: 0; /* Remove padding */
    flex: 1 1 auto; /* Take remaining space to center button */
    min-height: 0;
    align-self: stretch; /* Stretch to fill available space */
    width: 100%; /* Full width */
}

.btn-capture {
    background: var(--camera-btn-background-color);
    border: 4px solid var(--camera-btn-background-color);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-capture i {
    font-size: 32px;
    color: var(--camera-btn-icon-color);
}

.btn-capture:active {
    transform: scale(0.9);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    background: var(--button-active-color);
    border-color: var(--button-active-color);
}

.btn-capture:active i {
    color: var(--camera-btn-icon-color);
}

#players-page {
    background: var(--bg-color);
    padding: 15px;
    padding-bottom: 140px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    height: 100vh;
    max-height: 100vh;
    position: relative;
    will-change: scroll-position;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Players page CTA - uses same base styles as .cta-container */
/* #players-page-cta inherits all styles from .cta-container */

#players-page .container {
    overflow: visible;
    min-height: 0;
    flex: 0 1 auto;
    height: auto;
    max-height: none;
    padding-bottom: 40px; /* Additional padding for scroll space */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    align-items: flex-start;
    justify-content: flex-start;
    margin-top: 0;
}

#players-page .page-title {
    color: var(--white);
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    flex-shrink: 0;
    width: 100%;
    margin-top: 0;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    align-self: stretch;
    padding-bottom: 120px;
    margin-bottom: 30px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: contents;
}

.player-card {
    background: var(--player-card-background);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    aspect-ratio: 3/4;
    position: relative;
    border: 3px solid transparent;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.player-card:active {
    transform: scale(0.95);
}

.player-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), var(--shadow-lg);
    transform: scale(1.02);
    animation: selectPulse 0.5s ease-out;
}

.player-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary-color);
    color: var(--white);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: var(--shadow);
    z-index: 10;
    animation: checkmarkAppear 0.3s ease-out 0.2s both;
}

@keyframes selectPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1.02);
    }
}

@keyframes checkmarkAppear {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.player-card img {
    width: 100%;
    height: auto;
    flex: 1;
    object-fit: cover;
    background: var(--player-card-background);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.player-name {
    padding: 8px 6px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-color);
    background: var(--white);
    line-height: 1.2;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    order: -1;
    flex-shrink: 0;
}

.loading-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--white);
    padding: 40px 20px;
    min-height: 200px;
}

#players-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
}

.loading-message .spinner {
    margin-bottom: 15px;
}

.loading-message p {
    font-size: 16px;
}

.error-message {
    text-align: center;
    color: var(--white);
    padding: 4px 20px;
}

#players-error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
}

.error-message p {
    font-size: 16px;
}

#album-page {
    background: var(--bg-color);
    padding: 0;
    padding-bottom: 0;
    overflow: visible;
}

.processing-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 15px 20px;
    padding-top: max(15px, env(safe-area-inset-top));
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 0;
    z-index: 1000;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    width: 100%;
    background: var(--bg-color);
    border-radius: 2px;
    animation: progress-animation 2s ease-in-out infinite;
}

@keyframes progress-animation {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    color: var(--white);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin: 0;
}

#album-page .image-container {
    margin-bottom: 0;
    position: relative;
}

#album-page .container {
    min-height: calc(100vh - 130px);
    max-height: none;
    overflow: visible;
    justify-content: flex-start;
    gap: 10px;
    padding: 0;
    padding-bottom: 0;
    width: 100%;
    flex: 1;
    height: auto;
    box-sizing: border-box;
}


.selected-image-container img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    will-change: opacity;
}

.selected-image-container img.loaded {
    opacity: 1;
    animation: imageFadeIn 0.4s ease-in-out;
}

/* Shimmer effect for processing selected image */
.selected-image-container.processing {
    position: relative;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: shimmerBackground 2s infinite;
}

.selected-image-container.processing::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
    border-radius: 0;
    z-index: 1;
    pointer-events: none;
}

@keyframes imageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.thumbnail-carousel-wrapper {
    width: 100%;
    height: 8vh;
    max-height: 8vh;
    min-height: 50px;
    margin-bottom: 20px;
    padding: 0 15px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.thumbnail-swiper {
    width: 100%;
    height: 100%;
    padding: 10px 0;
    overflow: hidden;
}

.thumbnail-swiper .swiper-wrapper {
    align-items: center;
}

.thumbnail-slide {
    width: calc(8vh * 4 / 5) !important;
    height: 8vh !important;
    aspect-ratio: 4/5;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.6;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.thumbnail-slide.active {
    opacity: 1;
    transform: scale(1.1);
}

.thumbnail-slide img {
    width: 100%;
    height: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid transparent;
    transition: border-color 0.3s ease, opacity 0.4s ease-in-out;
    display: block;
    opacity: 0;
    position: relative;
}

.thumbnail-slide img.thumbnail-image-loading {
    opacity: 0;
}

.thumbnail-slide img.thumbnail-image-loaded {
    opacity: 1;
    animation: thumbnailFadeIn 0.4s ease-in-out;
}

/* Shimmer effect for processing images */
.thumbnail-slide.processing::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
    z-index: 1;
    pointer-events: none;
}

.thumbnail-slide.processing {
    position: relative;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: shimmerBackground 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes shimmerBackground {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes thumbnailFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.thumbnail-slide.active img {
    border-color: var(--white);
    box-shadow: var(--shadow);
}


.album-actions button {
    width: 100%;
}

.empty-album {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px 160px 20px;
    min-height: calc(100vh - 140px);
    box-sizing: border-box;
}

.empty-album-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.empty-album-icon {
    font-size: 80px;
    color: var(--white);
    opacity: 0.6;
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

.empty-album-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 15px;
    line-height: 1.2;
}

.empty-album-message {
    font-size: 16px;
    color: var(--white);
    opacity: 0.8;
    line-height: 1.5;
    margin-bottom: 40px;
}

.empty-album .cta-container {
    position: fixed;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 100%;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
}


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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 480px) {
    .page {
        padding: 10px;
        padding-bottom: 70px;
    }
    
    .container {
        padding: 8px;
    }
    
    .step-indicator {
        width: 36px;
        height: 36px;
        top: 15px;
        right: 15px;
    }
    
    .step-indicator .step-number {
        font-size: 16px;
    }
    
    .cta-btn, .btn-secondary {
        font-size: 16px;
        padding: 12px 24px;
        min-width: 160px;
    }
    
    .onboarding-content h1 {
        font-size: 18px;
    }
    
    
    .nav-item span {
        font-size: 10px;
    }
    
    .nav-item svg {
        width: 22px;
        height: 22px;
    }
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    height: 60px;
    max-height: 60px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 12px;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 0;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
    stroke-width: 2;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-item.active {
    color: var(--bg-color);
}

.nav-item:active {
    transform: scale(0.95);
    opacity: 0.7;
}

@supports (padding: max(0px)) {
    .page {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom)));
    }
    
    .bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        height: calc(60px + env(safe-area-inset-bottom));
    }
    
    /* Ensure all CTA containers have consistent safe area handling on mobile */
    .cta-container,
    .page.active .cta-container,
    #landing-page-cta,
    #terms-page-cta,
    #onboarding-page-cta,
    #userinfo-page-cta,
    #players-page-cta,
    #album-cta-container {
        bottom: max(68px, calc(60px + env(safe-area-inset-bottom) + 8px)) !important;
        padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
    }
}


