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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtext {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.95);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.search-section {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.search-description {
    max-width: 600px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    padding: 0 20px;
}

.search-description a {
    color: rgba(255, 255, 255, 1);
    text-decoration: underline;
    font-weight: 600;
    transition: opacity 0.2s;
}

.search-description a:hover {
    opacity: 0.8;
}

.search-container {
    display: flex;
    gap: 12px;
    max-width: 500px;
    width: 100%;
    background: white;
    padding: 8px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 16px 24px;
    font-size: 1rem;
    border-radius: 50px;
    background: transparent;
}

.search-input::placeholder {
    color: #999;
}

.search-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.leaderboard {
    margin-top: 60px;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: block;
    visibility: visible;
    opacity: 1;
}

.leaderboard.hidden {
    display: none !important;
}

.leaderboard-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.leaderboard-header h2 {
    color: #333;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-entry {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s;
    position: relative;
}

.leaderboard-entry:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.rank-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #5dade2;
    min-width: 60px;
    text-align: center;
}

.profile-picture {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
    position: relative; /* Required for absolute positioned images */
    overflow: hidden; /* Prevent image overflow */
}

.profile-picture img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    object-fit: cover !important;
    display: block !important; /* Force display on mobile */
    visibility: visible !important; /* Ensure visibility on mobile */
    opacity: 1 !important; /* Prevent transparency issues */
    -webkit-backface-visibility: hidden; /* Fix rendering issues on mobile */
    backface-visibility: hidden;
    transform: translateZ(0); /* Force hardware acceleration on mobile */
    -webkit-transform: translateZ(0); /* Safari mobile fix */
    position: relative; /* Ensure proper positioning */
    z-index: 1; /* Ensure image is above background */
    max-width: 100%; /* Prevent overflow on mobile */
    max-height: 100%; /* Prevent overflow on mobile */
}

.entry-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.entry-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.entry-handle {
    font-size: 0.9rem;
    color: #666;
}

.entry-amount {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    min-width: 120px;
    text-align: right;
}

.entry-actions {
    display: flex;
    gap: 10px;
    min-width: 200px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-claim {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.btn-claim:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-notify {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    flex: 1;
}

.btn-notify:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.terms-modal-content {
    max-width: 800px;
    max-height: 90vh;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

#claimForm {
    padding: 30px;
}

/* Phone Modal Specific Styles */
#phoneModal .modal-content {
    padding: 0;
}

#phoneModal .modal-header {
    padding: 30px 40px 24px 40px;
    border-bottom: 2px solid #f0f0f0;
}

#phoneModal #phoneForm {
    padding: 30px 40px 40px 40px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.form-group input[type="tel"],
.form-group input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fafafa;
}

.form-group input[type="tel"]:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group input[type="tel"]::placeholder,
.form-group input[type="text"]::placeholder {
    color: #999;
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
}

#phoneModal .form-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Phone Progress Modal Styles */
#phoneProgressModal .progress-modal-content {
    padding: 40px;
    text-align: center;
}

/* Regular Progress Modal (Searching for Unclaimed Funds) - use default padding from .progress-header and .progress-body */

.progress-header {
    margin-bottom: 30px;
}

.progress-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
    font-weight: 600;
}

.progress-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.progress-spinner {
    width: 80px;
    height: 80px;
    position: relative;
}

.progress-spinner .spinner {
    width: 80px;
    height: 80px;
    border: 6px solid #f0f0f0;
    border-top: 6px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-status {
    min-height: 40px;
}

.progress-message {
    font-size: 1.1rem;
    color: #333;
    font-weight: 500;
    margin: 0;
    transition: all 0.3s ease;
}

.progress-message.success {
    color: #10b981;
    font-weight: 600;
    font-size: 1.3rem;
}

.progress-message.error {
    color: #d32f2f;
    font-weight: 600;
    font-size: 1.2rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#mailingAddressModal .form-group input,
#mailingAddressModal .form-group select {
    padding: 12px 20px;
}

#mailingAddressModal #mailingAddressForm {
    padding: 30px 40px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #999;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 0;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.btn-cancel {
    flex: 1;
    background: #f0f0f0;
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-submit {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Results Modal Styles */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.results-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.results-content {
    padding: 30px;
}

.results-summary {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    margin-bottom: 30px;
}

.results-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.results-location {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0 0 20px 0;
}

.total-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.total-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.total-value {
    font-size: 2.5rem;
    font-weight: 700;
}

.results-list h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.2rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.result-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.result-entity {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.result-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
}

.results-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: center;
}

.btn-claim-paid:hover {
    background: #f0f0f0 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-claim-free:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Progress Modal Styles */
.progress-modal-content {
    max-width: 500px;
    text-align: center;
}

.progress-header {
    padding: 24px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.progress-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.progress-body {
    padding: 40px 30px;
}

.progress-spinner {
    margin-bottom: 30px;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-status {
    margin-bottom: 30px;
}

.progress-message {
    font-size: 1.1rem;
    color: #666;
    font-weight: 500;
    margin: 0;
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s;
}

.progress-step.active {
    background: #e8f0fe;
    border-left: 4px solid #667eea;
}

.progress-step.completed {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.progress-step.completed .step-icon {
    background: #4caf50;
    color: white;
}

.progress-step.active .step-icon {
    background: #667eea;
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: all 0.3s;
}

.step-text {
    flex: 1;
    color: #666;
    font-size: 0.95rem;
}

.progress-step.active .step-text {
    color: #667eea;
    font-weight: 600;
}

.progress-step.completed .step-text {
    color: #4caf50;
    font-weight: 600;
}

.progress-step.completed .step-icon::after {
    content: '✓';
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .leaderboard {
        margin-top: 40px !important;
        padding: 20px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .leaderboard.hidden {
        display: none !important;
    }

    .subtext {
        font-size: 1rem;
    }

    .search-container {
        flex-direction: column;
        border-radius: 16px;
    }

    .search-button {
        border-radius: 12px;
    }

    .leaderboard-entry {
        flex-wrap: wrap;
    }

    .entry-amount {
        min-width: 100px;
        font-size: 1.5rem;
    }

    .entry-actions {
        width: 100%;
        margin-top: 10px;
    }

    .rank-number {
        font-size: 2rem;
        min-width: 50px;
    }
    
    .profile-picture {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important; /* Prevent shrinking on mobile */
        min-height: 50px !important;
        max-width: 50px !important; /* Prevent expansion on mobile */
        max-height: 50px !important;
        flex-shrink: 0 !important; /* Never shrink on mobile */
        display: flex !important; /* Ensure flex display */
        overflow: hidden !important; /* Prevent image overflow */
    }
    
    .profile-picture img {
        display: block !important; /* Force display on mobile */
        visibility: visible !important; /* Force visibility */
        opacity: 1 !important; /* Prevent transparency issues */
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        position: absolute !important; /* Ensure proper positioning */
        top: 0 !important;
        left: 0 !important;
        z-index: 2 !important; /* Above background */
        -webkit-backface-visibility: visible !important; /* Ensure visible on iOS */
        backface-visibility: visible !important;
        transform: translateZ(0) !important; /* Force hardware acceleration */
        -webkit-transform: translateZ(0) !important; /* Safari mobile fix */
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-header,
    #claimForm {
        padding: 20px;
    }

    .progress-body {
        padding: 30px 20px;
    }

    .progress-steps {
        gap: 12px;
    }
}

/* CRITICAL: Additional mobile-specific rules to ensure profile pictures display */
@media (max-width: 768px) {
    .profile-picture {
        position: relative !important;
        overflow: hidden !important;
    }
    
    .profile-picture * {
        max-width: 100% !important;
        max-height: 100% !important;
    }
    
    /* Force images to be visible on mobile */
    .leaderboard-entry .profile-picture img {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Ensure container doesn't collapse */
    .leaderboard-entry .profile-picture:has(img) {
        min-height: 50px !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .profile-picture img {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        pointer-events: none; /* Prevent touch interference */
    }
}

/* Terms and Conditions Modal Styles */
.terms-content {
    padding: 30px;
    line-height: 1.8;
    color: #333;
}

.terms-content h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
    margin-top: 30px;
    margin-bottom: 15px;
}

.terms-content h3:first-of-type {
    margin-top: 0;
}

.terms-content p {
    margin-bottom: 15px;
    color: #555;
}

.terms-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.terms-content li {
    margin-bottom: 8px;
    color: #555;
}

.terms-content a {
    color: #667eea;
    text-decoration: underline;
}

.terms-content a:hover {
    color: #764ba2;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    background: #f8f9fa;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Footer Styles */
.site-footer {
    margin-top: 60px;
    padding: 30px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    margin: 8px 0;
    font-size: 0.9rem;
}

.footer-link {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.footer-link:hover {
    color: white;
    text-decoration: none;
}

