#community-impact-modal .modal-content {
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: visible;
}

#community-impact-modal-next-target,
.community-impact-modal-next-target {
    margin: 6px 0 14px 0;
    color: var(--text-primary);
    font-weight: 600;
}

#community-impact-modal h3 {
    margin-bottom: 12px;
}

.community-impact-modal-subtitle {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.community-impact-modal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: visible;
    padding-right: 4px;
}

.community-impact-tier-row {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 12px 2px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    overflow: visible;
}

.community-impact-tier-row.last {
    border-bottom: none;
}

.community-impact-tier-row.state-locked {
    opacity: 0.45;
}

.community-impact-tier-row.state-current {
    opacity: 1;
}

.community-impact-tier-row.state-unlocked {
    opacity: 0.9;
}

.community-impact-tier-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.06);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
    margin-bottom: 6px;
}

.community-impact-tier-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.community-impact-tier-name {
    font-weight: 700;
    font-size: 1.05em;
}

.community-impact-tier-desc {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.4;
}

.community-impact-tier-threshold {
    font-size: 1.1em;
    color: var(--text-primary);
    font-weight: 600;
}

/* Impact invite line (separate row under subtitle when shown) */
#community-impact-modal-impact-line {
    display: none;
    margin-top: 6px;
    font-weight: 600;
}

.impact-invite-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    margin-top: -15px !important;
    display: block;
    margin-bottom: 12px;
}

.impact-invite-link:hover {
    text-decoration: underline;
}

.community-impact-tier-state.unlocked {
    background: linear-gradient(90deg, #f7e5a1 0%, #f2c94c 100%);
    color: #5c4300;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007AFF;
    --primary-hover: #0051D5;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --bg-color: #FBFBFD;
    --card-bg: #FFFFFF;
    --border-color: #D2D2D7;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #FBFBFD;
    min-height: 100vh;
    padding: 0;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.has-banner {
    padding-top: 0;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Challenge Cards */
.challenge-cards-heading {
    font-size: 2.2em;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    text-align: center;
}

.challenge-cards-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0 0 24px 0;
    width: 100%;
}

.challenge-cards-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.challenge-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.challenge-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.challenge-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.challenge-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 12px;
}

.challenge-card-name {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.challenge-card-badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-live {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.badge-upcoming {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}

.badge-finished {
    background: rgba(142, 142, 147, 0.1);
    color: #8E8E93;
}

.challenge-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.challenge-card-date,
.challenge-card-enrolled,
.challenge-card-days {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.challenge-card-date i,
.challenge-card-enrolled i,
.challenge-card-days i {
    width: 18px;
    text-align: center;
    color: var(--primary-color);
}

.challenge-card-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.challenge-join-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 1em;
    font-weight: 600;
}

@media (max-width: 600px) {
    .challenge-cards-container {
        padding: 24px 16px;
    }
    
    .challenge-cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .challenge-card {
        padding: 20px;
    }
}

/* Leave Challenge Link */
.leave-challenge-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.leave-challenge-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.leave-challenge-link:hover {
    color: #d32f2f;
    background: rgba(211, 47, 47, 0.06);
}

.leave-challenge-link i {
    font-size: 0.85em;
}

@media (max-width: 600px) {
    .leave-challenge-container {
        padding: 20px 16px;
    }
    
    /* Remove hover effects on leaderboard items on mobile */
    .leaderboard-item:hover {
        background: inherit;
        box-shadow: inherit;
        transform: none;
        border-color: inherit;
    }
    
    /* Keep first place background on mobile even when touched */
    .leaderboard-item.first:hover,
    .leaderboard-item.first:active {
        background: var(--text-primary) !important;
        color: white !important;
        box-shadow: var(--shadow) !important;
        border: none !important;
    }
    
    .country-leaderboard-item:hover {
        background-color: inherit;
    }
    
    .athlete-leaderboard-item:hover {
        background-color: inherit;
    }
    
    /* Keep first place background for country and athlete leaderboard items on mobile */
    .country-leaderboard-item.first:hover,
    .country-leaderboard-item.first:active,
    .athlete-leaderboard-item.first:hover,
    .athlete-leaderboard-item.first:active {
        background: var(--text-primary) !important;
        color: white !important;
        box-shadow: var(--shadow) !important;
        border: none !important;
    }
}

/* Home Screen Banner */
.home-screen-banner {
    display: none;
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    opacity: 0;
    transition: top 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
    pointer-events: none;
}

.home-screen-banner.show {
    top: 20px;
    opacity: 1;
    pointer-events: auto;
}

.banner-content {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 280px;
    max-width: calc(100vw - 40px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.banner-content:active {
    transform: scale(0.98);
}

.banner-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.banner-text-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.banner-text {
    font-size: 1em;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.3;
}

.banner-subtext {
    font-size: 0.85em;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.banner-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.banner-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.banner-close:active {
    transform: scale(0.95);
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Dashboard Fullscreen Layout */
#dashboard-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    background: var(--bg-color);
    z-index: 10;
    width: 100vw;
    margin: 0;
    padding: 0;
    /* Enable pull-to-refresh in standalone mode */
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    /* Performance optimizations for iOS standalone mode */
    will-change: scroll-position;
    transform: translateZ(0); /* Force hardware acceleration */
    -webkit-transform: translateZ(0);
}

.dashboard-wrapper {
    min-height: 100vh;
    padding: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.dashboard-header {
    padding: 12px 60px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #1a1a1a;
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Ensure header stays on top during pull-to-refresh */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dashboard-header h1 {
    font-size: 2.2em;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
    text-align: left;
    flex: 1;
    color: white;
    font-style: italic;
}

/* User Profile Section */
.user-profile {
    position: relative;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.profile-info:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-image {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-info .leaderboard-profile-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-info .leaderboard-profile-placeholder span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.profile-name {
    font-size: 1em;
    font-weight: 500;
    color: white;
    letter-spacing: -0.01em;
}

.profile-chevron {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.2s ease;
}

.profile-info:hover .profile-chevron {
    transform: translateY(2px);
}

.profile-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border-color);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.profile-menu-item {
    width: 100%;
    padding: 14px 20px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1em;
    color: var(--text-primary);
    transition: background 0.2s ease;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.profile-menu-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.profile-menu-item i {
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
}

/* Profile Image Modal */
.profile-image-preview-container {
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-image-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d0d0d0;
    color: #666666;
    font-size: 64px;
}

.profile-image-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* Image Crop Tool */
.crop-wrapper {
    max-width: 400px;
    margin: 0 auto;
}

.crop-area {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: move;
    touch-action: none;
}

#crop-image {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    max-width: none;
    user-select: none;
    pointer-events: none;
    width: auto;
    height: auto;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    margin: -150px 0 0 -150px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.crop-zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 0 8px;
}

.zoom-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 18px;
}

.zoom-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

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

#zoom-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

#zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

#zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

#zoom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

#zoom-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.crop-instructions {
    margin-top: 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85em;
}

#preview-container {
    display: block;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8em;
    text-align: left;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: absolute;
    top: 10px;
    right: 10px;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 0;
    text-align: left;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    box-sizing: border-box;
    width: 100%;
    overflow-x: visible;
}

/* Duplicate Entry Modal - Improved spacing and hierarchy */
#duplicate-entry-modal .modal-body {
    padding-bottom: 0;
}

.duplicate-entry-content {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-top: 18px;
}

.duplicate-entry-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color(display-p3 0.881 0.919 0.99);
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 32px;
}

.duplicate-entry-icon i {
    display: block;
}

.duplicate-entry-message {
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 400;
    margin: 0;
    flex: 1;
}

#duplicate-entry-modal .modal-footer {
    margin-top: 32px;
    padding-top: 24px;
    display: flex;
    gap: 12px;
}

#duplicate-entry-modal .modal-footer .btn {
    flex: 1;
}

.duplicate-entry-cancel {
    text-align: center;
    margin-top: 16px;
    padding-top: 0;
    margin-bottom: 0;
}

/* Mobile: Stack buttons for duplicate entry modal */
@media (max-width: 600px) {
    #duplicate-entry-modal .modal-footer {
        flex-direction: column;
    }
    
    #duplicate-entry-modal .modal-footer .btn {
        width: 100%;
    }
    
    .duplicate-entry-content {
        gap: 16px;
    }
    
    .duplicate-entry-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
}

.modal-body .btn {
    margin: 8px;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.btn-spinner-circle {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

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

/* Dark button spinner */
.btn-secondary .btn-spinner-circle,
.btn-danger .btn-spinner-circle {
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.6);
}

/* Account item loading state */
.account-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
    overflow: visible;
}

.modal-footer button {
    box-sizing: border-box;
    min-width: 0;
    flex-shrink: 1;
    max-width: 100%;
    margin-bottom: 0; /* Override default btn margin-bottom */
}

/* Ensure buttons in modal-footer use consistent styling */
.modal-footer .btn {
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0; /* Override default btn margin-bottom */
}

/* Single button in modal-footer takes full width */
.modal-footer button:only-child {
    width: 100%;
    flex: 1;
}

/* For modals with multiple buttons (2+), make them equal width */
.modal-footer button:first-child:not(:only-child) {
    flex: 1;
}

.modal-footer button:not(:first-child):not(:only-child) {
    flex: 1;
}

.modal-footer button[style*="width: 100%"] {
    width: calc(100% - 0px) !important;
    max-width: 100%;
}

.dashboard-title-section {
    flex: 1;
}

.dashboard-title-section h1 {
    margin-bottom: 8px;
}

.dashboard-challenge-dates {
    margin-bottom: 8px;
}

.dashboard-challenge-dates .challenge-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.dashboard-challenge-dates .challenge-name-text {
    display: inline;
    font-size: 1.1em;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.challenge-date-text {
    font-size: 1.1em;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.01em;
    display: block;
}

.dashboard-user-start-date {
    margin-top: 4px;
}

.user-start-date-text {
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

.rules-icon {
    margin-right: 8px;
    font-size: 0.95em;
}

.dashboard-main {
    padding: 24px 60px 40px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    /* Allow transform for pull-to-refresh */
    transition: transform 0.3s ease;
    position: relative;
    /* Performance optimizations for iOS standalone mode */
    will-change: transform;
    /* Use translate3d for hardware acceleration without conflicting with dynamic transforms */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

/* Ensure challenge content sections have consistent top spacing for indicator positioning */
.challenge-cards-container,
.dashboard-content {
    position: relative;
    padding-top: 0; /* Remove any top padding to allow indicator positioning */
}

.challenge-cards-container {
    padding-top: 32px; /* Restore padding but account for indicator */
}

.dashboard-challenge-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.dashboard-challenge-left {
    flex: 1;
}

.dashboard-challenge-right {
    display: flex;
    align-items: center;
}

.challenge-participants-inline {
    margin-top: 6px;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.challenge-participants-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.challenge-participants-link:hover {
    opacity: 0.8;
}

.dashboard-primary {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.waitlist-banner {
    background: #710dff;
    border-radius: 12px;
    padding: 20px 24px;
    margin-top: 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-subtle);
}

.waitlist-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.waitlist-banner-content span {
    color: white;
    font-size: 1.4em;
    font-weight: 500;
    flex: 1;
    min-width: 200px;
}

.waitlist-banner-content span strong {
    font-weight: 700;
    color: white;
}

.waitlist-banner-content .challenge-date-bold {
    font-weight: 700;
}

.btn-join-waitlist {
    background: white;
    color: black;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-join-waitlist:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-join-waitlist:active {
    transform: translateY(0);
}

.dashboard-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn-full {
    width: 100%;
}

/* Action Buttons */
.btn-add-entry,
.btn-invite-friends {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 24px 32px;
    font-size: 1.2em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-subtle);
    letter-spacing: -0.01em;
    width: 100%;
}

.btn-add-entry:hover,
.btn-invite-friends:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-hover);
}

.btn-add-entry:active,
.btn-invite-friends:active {
    transform: scale(0.98);
}

.btn-icon {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.time-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-input-wrapper .date-input {
    flex: 1;
}

.remove-time-btn {
    background: #FF3B30;
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.remove-time-btn:hover {
    background: #D63027;
}

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

.btn-text {
    font-weight: 500;
}

/* Stats Grid */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px 28px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    text-align: center;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: none;
    position: relative;
}

.stat-card:hover {
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.stat-card-featured {
    background: var(--text-primary);
    color: white;
    border: none;
}

.stat-card-featured .stat-label,
.stat-card-featured .stat-unit {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card-completed {
    background: #34C759 !important;
    color: white;
    border: none;
}

.stat-card-completed .stat-label,
.stat-card-completed .stat-unit {
    color: rgba(255, 255, 255, 0.9);
}

.stat-card-completed .stat-value {
    color: white;
}

.stat-checkmark {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 1.8em;
    color: white;
    opacity: 0.95;
}


.stat-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 400;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stat-value {
    font-size: 3em;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-card-featured .stat-value {
    color: white;
}

.stat-unit {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.stat-sublabel {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.stat-card-featured .stat-sublabel {
    color: rgba(255, 255, 255, 0.7);
}

.stat-card-completed .stat-sublabel {
    color: rgba(255, 255, 255, 0.9);
}

/* Invite Card */
.invite-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.invite-cards-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

@media (max-width: 600px) {
    .invite-cards-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.invite-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.invite-text {
    font-size: 1em;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.6;
}

.community-impact-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0;
}

.community-impact-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.community-impact-icon {
    color: var(--primary-color);
}

.community-impact-title {
    font-size: 1.1em;
    color: var(--text-primary);
}

.community-impact-tooltip .tooltip {
    max-width: 260px;
}

.community-impact-value-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.community-impact-score-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1 1 0%;
    min-width: 0px;
}

.community-impact-score {
    font-size: 4.5em;
    font-weight: 800;
    color: #1d1d1f;
    line-height: 1.1;
}

.community-impact-level-desc {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.4;
    max-width: 360px;
}

.community-impact-invite-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.community-impact-invite-link:hover {
    opacity: 0.8;
}

.community-impact-subtitle {
    font-size: 0.95em;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0;
}

.community-impact-badges {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0 30px 0 20px;
    overflow: visible;
}

/* Modern Community Impact badge */
.community-impact-badges .badge {
    position: relative;
    margin: 0;
    width: 3.6em;
    height: 5.6em;
    border-radius: 10px;
    display: inline-block;
    transition: 0.2s;
    overflow: visible;
}

.community-impact-badges .badge:hover {
    transform: translateY(-4px);
}

.community-impact-badges .badge.locked,
.community-impact-badges .badge.locked:hover {
    pointer-events: none;
    transform: none;
}

/* Back plates */
.community-impact-badges .badge::before,
.community-impact-badges .badge::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: inherit;
    top: 0;
    left: 0;
    transform-origin: center;
}

.community-impact-badges .badge::before {
    transform: rotate(60deg);
}

.community-impact-badges .badge::after {
    transform: rotate(-60deg);
}

/* Circle icon wrapper */
.community-impact-badges .badge .circle {
    width: 54px;
    height: 54px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    inset: 0;
    margin: auto;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-impact-badges .badge .circle i {
    font-size: 28px;
    color: inherit;
}

/* Ribbon label */
.community-impact-badges .badge .ribbon {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    color: #fff;
    background: rgba(0,0,0,0.8);
    border-radius: 4px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    font-weight: 600;
    z-index: 20;
    min-width: 100px;
    text-align: center;
}

/* Colour gradients */
.community-impact-badges .badge.blue {
    background: linear-gradient(to bottom right, #4FC3F7, #2196F3);
    color: #2196F3;
}

.community-impact-badges .badge.blue-dark {
    background: linear-gradient(to bottom right, #1976D2, #283593);
    color: #1976D2;
}

.community-impact-badges .badge.teal {
    background: linear-gradient(to bottom right, #4DB6AC, #00796B);
    color: #00796B;
}

.community-impact-badges .badge.green {
    background: linear-gradient(to bottom right, #CDDC39, #8BC34A);
    color: #8BC34A;
}

.community-impact-badges .badge.deep-green {
    background: linear-gradient(to bottom right, #9ccc65, #2c7e17);
    color: #456f20;
}

.community-impact-badges .badge.red {
    background: linear-gradient(to bottom right, #F4511E, #B71C1C);
    color: #B71C1C;
}

.community-impact-badges .badge.gold {
    background: linear-gradient(to bottom right, #e6ce6a, #b7892b);
    color: #b7892b;
}

.community-impact-badges .badge.locked {
    opacity: 0.65;
    overflow: visible;
}

.community-impact-badges .badge.current {
    box-shadow: 0 10px 25px rgba(0,0,0,0.18);
}

/* Slightly smaller badges on dashboard card only (about 10% reduction) */
#community-impact-card .community-impact-badges .badge {
    width: 3.25em;
    height: 5.05em;
}

#community-impact-card .community-impact-badges .badge .circle {
    width: 49px;
    height: 49px;
}

#community-impact-card .community-impact-badges .badge .circle i {
    font-size: 25px;
}

.invite-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.invite-count-clickable {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.invite-count-clickable:hover {
    color: var(--primary-color-dark, #0056b3);
    text-decoration: none;
}

.invite-some-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.invite-some-link:hover {
    color: var(--primary-color-dark, #0056b3);
    text-decoration: none;
}

.invite-more-link {
    margin-top: 4px;
}

.invite-more-link .invite-some-link {
    font-size: 0.95em;
}

.invite-link-row {
    margin-top: 4px;
}

/* Profile Pictures Container */
.invite-profile-pics {
    display: flex;
    align-items: center;
    position: relative;
    height: 40px;
    flex-wrap: nowrap;
    overflow: visible;
}

.invite-profile-pic-wrapper {
    position: relative;
    display: inline-flex;
    width: 40px;
    height: 40px;
    margin-left: -8px; /* 20% overlap */
}

.invite-profile-pic-wrapper:first-child {
    margin-left: 0;
}

.invite-pics-clickable {
    cursor: pointer;
    transition: opacity 0.2s ease;
    display: inline-flex;
    width: fit-content;
    align-items: center;
}

.invite-pics-clickable:hover {
    opacity: 0.8;
}

.invite-profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    object-fit: cover;
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Default avatar with initials - must override base .invite-profile-pic styles */
.invite-profile-pic.invite-pic-default {
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    /* Remove object-fit for divs */
    object-fit: unset;
}

.invite-profile-pic.invite-pic-default span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
    font-size: inherit;
    color: inherit;
}

/* Fade effect for last two pics when showing more than 8 pics (i.e., 9 or 10 pics) */
/* Second-to-last image: starts fading partway through, creating seamless transition */
.invite-pic-fade-second {
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0.4) 100%);
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0.4) 100%);
}

/* Last image: continues fade from second-to-last, ending at complete transparency */
.invite-pic-fade-last {
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0) 100%);
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0) 100%);
}

/* Legacy fade class for backward compatibility (when showing 7-8 pics) */
.invite-pic-fade {
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 60%, rgba(0, 0, 0, 0) 100%);
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 60%, rgba(0, 0, 0, 0) 100%);
}

/* Legacy styles for backward compatibility */
.invite-line {
    font-size: 1em;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
    line-height: 1.6;
}

.invite-line:last-child {
    margin-bottom: 0;
}

.invite-label {
    color: var(--text-secondary);
    margin-right: 8px;
}

/* Mobile styles for invite card */
@media (max-width: 600px) {
    .invite-card {
        width: 100%;
        max-width: 100%;
    }
    
    .invite-profile-pic {
        width: 36px;
        height: 36px;
    }
    
    .invite-profile-pics {
        height: 36px;
    }
    
    .invite-profile-pic-wrapper {
        width: 36px;
        height: 36px;
        margin-left: -7px; /* Slightly less overlap on mobile */
    }
    
    .invite-profile-pic-wrapper:first-child {
        margin-left: 0;
    }
    
    .invite-profile-pic.invite-pic-default {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
}

.skip-logout-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
    text-align: center;
    display: inline-block;
    padding: 8px;
    transition: color 0.2s ease;
}

.skip-logout-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.before-you-go-footer .btn-fullwidth {
    width: 100%;
}

.before-you-go-skip {
    text-align: center;
    margin-top: 12px;
}

/* Leaderboard Section */
.leaderboard-section {
    padding: 0 60px 60px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Progress section */
.progress-section {
    padding: 0 0 15px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 16px;
}

.progress-header h2 {
    font-size: 1.6em;
    margin: 0;
    color: var(--text-primary);
}

.progress-chart-wrapper {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    min-height: 260px;
}

#progress-chart {
    width: 100%;
    height: 250px;
}

#progress-chart-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: var(--shadow-subtle);
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
}

h1 {
    font-size: 3.2em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2.4em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 48px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 48px;
    font-size: 1.3em;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

#dashboard-screen.active {
    display: block;
    position: fixed;
}

/* Entry screen as modal overlay - dashboard visible behind it (blurred) */
#entry-screen {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    display: none;
}

#entry-screen.active {
    display: flex !important;
}

#entry-screen .card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 32px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#entry-screen .card h2 {
    margin-bottom: 24px;
    text-align: left;
}

/* ============================================
   GLOBAL FORM STYLING SYSTEM
   Clean, consistent spacing across all forms
   ============================================ */

/* Form container - ensures consistent spacing */
form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Form group - main spacing unit between fields */
.form-group {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

.form-group:last-of-type {
    margin-bottom: 0;
}

/* Ensure consistent spacing before buttons */
form > .btn-primary,
form > .btn-secondary,
form > button[type="submit"],
form > .modal-footer {
    margin-top: 24px;
}

form > .form-footer {
    margin-top: 24px;
}

/* Starting pushups CTA note with fade-in */
.starting-cta-wrapper {
    position: relative;
    margin-top: 24px; /* Consistent spacing from last form group */
}

.starting-cta-note {
    text-align: center;
    margin-top: 10px;
    font-size: 0.85em;
    color: var(--text-secondary);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    min-height: 1.5em; /* Maintain line height even when hidden */
    line-height: 1.5;
}

.starting-cta-note.visible {
    opacity: 1;
    visibility: visible;
}

/* Name row - for side-by-side name fields */
.name-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px;
    margin-bottom: 10px;
}

.name-row.form-group {
    margin-bottom: 10px;
}

.name-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.name-field label {
    display: block;
    margin-bottom: 8px;
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95em;
    letter-spacing: -0.01em;
    line-height: 1.5;
}

.name-field input {
    width: 100%;
}

/* Social Media Accounts */
.social-media-accounts {
    margin-bottom: 0;
}

.social-media-row {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.social-media-row:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.social-media-fields {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.social-platform-field {
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
}

.social-platform-field select {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95em;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.social-platform-field select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.social-handle-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.social-handle-field input {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95em;
    font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.social-handle-field input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-remove-social {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
}

.btn-remove-social:hover {
    background: #fee;
    border-color: #dc3545;
    color: #dc3545;
}

.btn-remove-social:active {
    background: #fdd;
    border-color: #c82333;
    color: #c82333;
    transform: scale(0.95);
}

.btn-remove-social i {
    font-size: 1em;
    pointer-events: none;
    line-height: 1;
}

#add-social-account-btn {
    margin-top: 8px;
    padding: 10px 16px;
    font-size: 0.9em;
    width: fit-content;
    display: inline-flex;
    align-items: center;
}

#add-social-account-btn.btn-small {
    padding: 8px 14px;
    font-size: 0.85em;
}

#add-social-account-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

label {
    display: block;
    margin-bottom: 8px;
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95em;
    letter-spacing: -0.01em;
    line-height: 1.5;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="time"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1em;
    line-height: 1.5;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    box-sizing: border-box;
    min-height: 48px; /* Ensure consistent height with date inputs */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Readonly inputs styling */
input[readonly] {
    background: var(--bg-color);
    cursor: default;
    opacity: 0.7;
}

input[readonly]:focus {
    border-color: var(--border-color);
    box-shadow: none;
    background: var(--bg-color);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="time"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

input[readonly]:focus {
    border-color: var(--border-color);
    box-shadow: none;
    background: var(--bg-color);
}

input[type="email"],
input[type="tel"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231D1D1F' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
    box-sizing: border-box;
}

.required {
    color: #FF3B30;
    font-weight: 600;
}

.optional {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.9em;
}

/* Form help text - appears below inputs */
.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.85em;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    line-height: 1.4;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    background: var(--bg-color);
    padding: 4px;
    border-radius: 12px;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 400;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.toggle-btn.active {
    background: var(--card-bg);
    color: var(--text-primary);
    font-weight: 500;
}

/* Auth Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* Form footer - for links below forms */
.form-footer {
    margin-top: 24px;
    text-align: center;
}

/* Button styling in forms */
form .btn-primary,
form .btn-secondary,
form button[type="submit"] {
    width: 100%;
    margin-top: 0; /* Spacing handled by form > selector above */
}

/* Auth forms - buttons are direct children, spacing handled above */
.auth-form .btn-primary {
    width: 100%;
}

.form-footer p {
    font-size: 1em;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.login-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.login-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* Birthday Inputs */
.date-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1em;
    line-height: 1.5;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
    min-height: 48px; /* Ensure consistent height with other inputs */
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Date input styling for better mobile experience */
.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

.date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.date-input::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
    line-height: 1.5;
}

.date-input::-webkit-datetime-edit-text {
    color: var(--text-secondary);
    padding: 0 4px;
    line-height: 1.5;
}

.date-input::-webkit-datetime-edit-month-field,
.date-input::-webkit-datetime-edit-day-field,
.date-input::-webkit-datetime-edit-year-field {
    color: var(--text-primary);
    line-height: 1.5;
    padding: 0;
}

/* Country Select */
#country {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
    background: var(--bg-color);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    cursor: pointer;
}

#country:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Account Selection */
.account-selection {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.account-selection h3 {
    font-size: 1.4em;
    margin-bottom: 12px;
}

.account-selection p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.account-item {
    padding: 16px 20px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-item:hover {
    background: #FFFFFF;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-subtle);
}

.account-name {
    font-size: 1.1em;
    font-weight: 500;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.account-id {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, monospace;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 100%;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #0051D5;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--text-secondary);
}

.btn-danger {
    background: #FF3B30;
    color: white;
}

.btn-danger:hover {
    background: #D70015;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.95em;
    width: auto;
    margin: 0;
}

.nav-buttons {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cancel-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s ease;
    cursor: pointer;
    display: inline-block;
}

.cancel-link:hover {
    color: var(--text-primary);
}

.goal-display {
    background: var(--bg-color);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.goal-label {
    font-size: 1.1em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.goal-number {
    font-size: 4.5em;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

/* Bonus Workout Info */
.bonus-workout-info {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 165, 0, 0.1) 100%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.bonus-workout-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bonus-workout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.bonus-label {
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 500;
}

.bonus-value {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
}

.bonus-status {
    font-size: 1em;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
}

.bonus-status.achieved {
    color: #34C759;
    background: rgba(52, 199, 89, 0.1);
}

.bonus-status.pending {
    color: #FF9500;
    background: rgba(255, 149, 0, 0.1);
}

#bonus-remaining-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

/* Mobile optimizations for bonus workout info */
@media (max-width: 480px) {
    .bonus-workout-info {
        padding: 16px;
    }
    
    .bonus-value {
        font-size: 1.1em;
    }
    
    .bonus-status {
        font-size: 0.9em;
        padding: 5px 10px;
    }
}

/* Challenge Confirmation Screen */
.challenge-confirmation-content {
    margin: 5px 0;
    text-align: center;
}

.challenge-info {
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: center;
}

.challenge-dates-display {
    margin-bottom: 8px;
}

.challenge-name-section {
    margin-bottom: 24px;
}

.challenge-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.challenge-name-display {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
    flex: 1;
}

.challenge-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.challenge-status-badge.active {
    background: #34C759;
    color: white;
}

.challenge-status-badge.upcoming {
    background: #FF9500;
    color: white;
}

.challenge-status-badge.finished {
    background: var(--text-secondary);
    color: white;
}

.challenge-date-range {
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.01em;
    margin: 0;
}

/* Flip Counter */
.flip-counter-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    width: 100%;
}

.flip-counter {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.flip-digit-card {
    position: relative;
    width: 160px;
    height: 240px;
    min-width: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 4px 16px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 1;
    flex-grow: 0;
}

.flip-digit-flap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 1) 0%,
        rgba(248, 248, 248, 1) 50%,
        rgba(255, 255, 255, 1) 100%);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    overflow: hidden;
}

.flip-digit-top {
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    transform-origin: bottom;
}

.flip-digit-top::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.flip-digit-bottom {
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    transform-origin: top;
}

.flip-digit-bottom::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.05);
}

.flip-digit-divider {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), 
                0 -1px 1px rgba(255, 255, 255, 0.5);
    transform: translateY(-50%);
    z-index: 2;
}

.flip-digit-content {
    font-size: 9em;
    font-weight: 700;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1;
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    top: 0;
    left: 0;
    text-align: center;
    vertical-align: middle;
}


.flip-digit-top .flip-digit-content {
    bottom: 0;
    top: auto;
    transform: translateY(50%);
}

.flip-digit-bottom .flip-digit-content {
    top: 0;
    bottom: auto;
    transform: translateY(-50%);
}

.flip-digit-card.flip-animate .flip-digit-top {
    animation: flipTop 0.6s ease-in-out;
}

.flip-digit-card.flip-animate .flip-digit-bottom {
    animation: flipBottom 0.6s ease-in-out;
}

@keyframes flipTop {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(-90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

@keyframes flipBottom {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.flip-counter-label {
    font-size: 1.2em;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.challenge-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.challenge-status-message {
    font-size: 2em;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.challenge-message {
    font-size: 1.5em;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.challenge-submessage {
    font-size: 1.1em;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.btn-large {
    padding: 18px 48px;
    font-size: 1.2em;
    font-weight: 600;
    margin-top: 32px;
}

.skip-enrollment-link {
    margin-top: 16px;
    text-align: center;
}

.skip-enrollment-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s ease;
}

.skip-enrollment-link a:hover {
    color: var(--primary-color);
}

.duplicate-account-info {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.duplicate-account-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95em;
    color: var(--text-primary);
}

.duplicate-account-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Home Screen Instructions Modal */
.home-screen-instructions-content {
    margin: 24px 0;
}

.instructions-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.instruction-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

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

.step-content {
    flex: 1;
    padding-top: 4px;
}

.step-content p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.5;
}

.step-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.step-content i {
    color: var(--primary-color);
    margin: 0 4px;
}

.instructions-note {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9em;
    text-align: center;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.instructions-note-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: contain;
}

.instructions-note span {
    flex: 1;
}

/* Before You Go Modal - Custom styling */
.before-you-go-note {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-top: 0 !important;
    text-align: left !important;
    justify-content: flex-start !important;
}

.before-you-go-note .instructions-note-icon {
    width: 64px;
    height: 64px;
}

.before-you-go-note span {
    text-align: left !important;
    display: block;
}

/* Confirmation Modal */
.confirmation-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.confirmation-header {
    text-align: center;
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.confirmation-date {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 16px;
}

.bonus-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1D1D1F;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    width: fit-content;
    max-width: 100%;
}

.bonus-badge i {
    font-size: 0.875rem;
}

.confirmation-stats {
    margin-bottom: 32px;
}

.confirmation-stat-large {
    text-align: center;
    margin-bottom: 32px;
    padding: 32px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.confirmation-stat-value {
    font-size: 4.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.confirmation-stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.confirmation-stat-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.confirmation-stat-small {
    text-align: center;
    padding: 24px 16px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.confirmation-stat-value-small {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.confirmation-stat-label-small {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.confirmation-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 20px 0;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
}

.confirmation-warning i {
    color: #ffc107;
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.confirmation-warning span {
    flex: 1;
}

/* Confirmation actions wrapper removed - buttons are now direct children of modal-footer */

/* Mobile optimizations */
@media (max-width: 480px) {
    .confirmation-header {
        margin-bottom: 24px;
}

    .confirmation-stat-value {
        font-size: 3.5rem;
    }

    .confirmation-stat-value-small {
        font-size: 1.75rem;
    }

    .confirmation-stat-large {
        padding: 24px;
    }

    .confirmation-stat-small {
        padding: 20px 12px;
    }
    
    .confirmation-warning {
        font-size: 13px;
        padding: 10px;
        margin: 0 0 20px 0;
    }
    
    .confirmation-warning i {
        font-size: 14px;
    }
}

.rules-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1em;
    letter-spacing: -0.01em;
    transition: background 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(0, 122, 255, 0.06);
}

.rules-link:hover {
    opacity: 0.9;
    background: rgba(0, 122, 255, 0.12);
}

.rules-icon {
    font-size: 0.9em;
}



.leaderboard {
    margin-top: 0;
}

/* Notifications Section */
.notifications-section {
    padding: 0 60px 60px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.notifications-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
}

.notifications-column {
    display: flex;
    flex-direction: column;
}

.notifications-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.notifications-column h3 {
    font-size: 1.6em;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.notifications-column-header h3 {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.refresh-feed-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    margin-left: auto;
}

.refresh-feed-btn:hover {
    background: rgba(0, 122, 255, 0.1);
}

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

.refresh-feed-btn i {
    transition: transform 0.3s ease;
}

.refresh-feed-btn i.spinning {
    animation: spin 0.6s linear infinite;
}

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

.notifications-list {
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease;
}

.notifications-list.fading-out {
    opacity: 0;
}

.notifications-list.fading-in {
    opacity: 1;
}

.show-more-link {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 12px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s ease, opacity 0.2s ease;
    text-align: center;
    align-self: flex-start;
    background: rgba(0, 122, 255, 0.06);
}

.show-more-link:hover {
    opacity: 0.9;
    background: rgba(0, 122, 255, 0.12);
    text-decoration: none;
}

.notification-card {
    background: var(--card-bg);
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.notification-card:hover {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.1);
}

.notification-card-clickable:hover {
    background: rgba(0, 122, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Notification Reactions - Compact Design */
.notification-reactions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    line-height: 1;
    vertical-align: middle;
    margin-left: auto;
}

.reaction-button-compact {
    background: transparent;
    border: none;
    border-radius: 16px;
    padding: 2px 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
    vertical-align: middle;
}

.reaction-comment-button {
    font-size: 14px;
    color: var(--text-secondary);
}

.reaction-comment-button:hover {
    color: var(--primary-color);
    background: rgba(0, 122, 255, 0.1);
}

.reaction-button-compact:hover {
    background: var(--bg-color);
    transform: scale(1.1);
}

.reaction-button-compact.active {
    background: rgba(0, 122, 255, 0.1);
}

.reaction-count-small {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 1px;
    line-height: 1;
}

.reaction-button-compact.active .reaction-count-small {
    color: var(--primary-color);
}

.reaction-view-all-compact {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.15s ease;
    line-height: 1;
    vertical-align: middle;
}

.reaction-view-all-compact:hover {
    color: var(--primary-color);
}

.reaction-add-button {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
    color: var(--text-secondary);
    opacity: 0.6;
    min-width: 24px;
    min-height: 24px;
}

.reaction-add-button:hover {
    opacity: 1;
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: scale(1.05);
}

.reaction-add-button i {
    font-size: 14px;
    line-height: 1;
}

/* Reaction Picker Tooltip */
.reaction-picker {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 4px;
    align-items: center;
}

.reaction-picker-emoji {
    background: transparent;
    border: none;
    border-radius: 16px;
    padding: 6px 10px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

.reaction-picker-emoji:hover {
    background: var(--bg-color);
    transform: scale(1.15);
}

/* Mobile styles for reactions */
@media (max-width: 768px) {
    .reaction-button-compact {
        font-size: 14px;
        padding: 2px 4px;
    }
    
    .reaction-picker-emoji {
        font-size: 16px;
        padding: 4px 8px;
        min-width: 32px;
        min-height: 32px;
    }
    
    .reaction-add-button {
        padding: 3px 6px;
        min-width: 20px;
        min-height: 20px;
    }
    
    .reaction-add-button i {
        font-size: 12px;
    }
    
    .notification-card {
        padding: 12px 16px;
    }
}

/* Reactions Modal */
.reactions-modal-content {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.reactions-modal-context {
margin-bottom: 16px;
font-size: 14px;
color: var(--text-secondary);
line-height: 1.5;
}

.reactions-modal-context .notification-card:hover,
.reactions-modal-context .notification-card-clickable:hover {
background: inherit;
box-shadow: inherit;
transform: none;
border-color: inherit;
}

.reactions-modal-container {
    max-height: 60vh;
    overflow-y: auto;
}

.reactions-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* Reactions Tabs */
.reactions-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
    padding-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.reactions-tabs::-webkit-scrollbar {
    display: none;
}

.reaction-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-bottom: -2px;
}

.reaction-tab:hover {
    color: var(--text-primary);
    background: var(--bg-color);
}

.reaction-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.reaction-tab-emoji {
    font-size: 20px;
    line-height: 1;
}

.reaction-tab-icon {
    font-size: 16px;
    line-height: 1;
}

.reaction-tab-count {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 24px;
    text-align: center;
}

.reaction-tab.active .reaction-tab-count {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Reactions Tab Content */
.reactions-tab-content {
    position: relative;
}

.reaction-tab-panel {
    display: none;
}

.reaction-tab-panel.active {
    display: block;
}

.reaction-tab-panel-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Comments Panel */
.comments-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-input-container {
    margin-bottom: 8px;
}

.comment-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.comment-submit-btn {
    align-self: flex-end;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-submit-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.comment-submit-btn:active {
    transform: translateY(0);
}

.comments-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    margin-top: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.comment-item:first-child {
    margin-top: 0;
}

.comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.comment-reply {
    margin-top: 0;
    padding-top: 0;
    padding-left: 32px;
    border-top: none;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.comment-avatar .leaderboard-profile-placeholder {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.comment-author:hover {
    color: var(--primary-color);
}

.comment-time {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.comment-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.comment-actions {
    display: flex;
    gap: 12px;
}

.comment-reply-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.comment-reply-btn:hover {
    color: var(--primary-color);
}

.comment-replies {
    margin-top: 12px;
}

.comment-reply-input-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.comment-reply-input {
    font-size: 13px;
    min-height: 50px;
}

.comment-reply-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comment-cancel-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-cancel-btn:hover {
    background: var(--bg-color);
    border-color: var(--text-secondary);
}

/* Mobile styles for comments */
@media (max-width: 768px) {
    .comment-item {
        padding: 10px 0;
        gap: 10px;
    }
    
    .comment-avatar {
        width: 32px;
        height: 32px;
    }
    
    .comment-avatar .leaderboard-profile-placeholder {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .comment-author {
        font-size: 13px;
    }
    
    .comment-text {
        font-size: 13px;
    }
    
    .comment-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 8px 10px;
    }
    
    .comment-reply {
        padding-left: 24px;
    }
}

.reaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.reaction-item:hover {
    background: var(--bg-color);
}

.reaction-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.reaction-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reaction-item-avatar .leaderboard-profile-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.reaction-item-content {
    flex: 1;
    min-width: 0;
}

.reaction-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.reaction-item-time {
    font-size: 12px;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .reaction-button {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 12px;
    }
    
    .reaction-view-all {
        min-height: 44px;
        min-width: 44px;
    }
}

.notification-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Clickable avatar in activity log notifications */
.notification-avatar-clickable {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.notification-avatar-clickable:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* Name link in activity log notifications - bold, no underline, no color change */
.notification-name-link {
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.notification-name-link:hover {
    opacity: 0.8;
}

/* Badge avatar for community impact badges in notifications */
.notification-avatar.notification-badge-avatar {
    width: 48px;
    height: 48px;
    border-radius: 0;
    border: none;
    background: transparent;
    overflow: visible;
    align-items: center;
    justify-content: center;
}

.notification-badge-wrapper {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scale down the badge to fit notification size */
.community-impact-badges.notification-badge-wrapper {
    transform: scale(0.5);
}

/* Smaller badge size for notifications - same size as icon circle (48px) */
.notification-badge-wrapper .community-impact-badges {
    margin: 0 !important;
}

.notification-badge-wrapper .community-impact-badges .badge {
    width: 1.2em !important;
    height: 1.8em !important;
    margin: 0 !important;
    border-radius: 6px !important;
}

.notification-badge-wrapper .community-impact-badges .badge:hover {
    transform: none !important;
}

.notification-badge-wrapper .community-impact-badges .badge .circle {
    width: 24px !important;
    height: 24px !important;
}

.notification-badge-wrapper .community-impact-badges .badge .circle i {
    font-size: 12px !important;
}

.notification-badge-wrapper .community-impact-badges .badge .ribbon {
    font-size: 7px !important;
    padding: 1px 4px !important;
    min-width: 40px !important;
    bottom: 2px !important;
    line-height: 1.1 !important;
    letter-spacing: 0.3px !important;
}

.notification-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notification-avatar .notification-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: #fff;
    font-size: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.notification-avatar .notification-icon i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 20px;
}

.notification-avatar .country-flag {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--bg-color);
}

.notification-content {
    flex: 1;
    min-width: 0;
    position: relative;
}

.notification-text {
    font-size: 1em;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.notification-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.notification-text a.notification-invite-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.notification-text a.notification-invite-link:hover {
    opacity: 0.8;
}

.notification-text a.notification-upload-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.notification-text a.notification-upload-link:hover {
    opacity: 0.8;
}

.notification-timestamp {
    font-size: 0.85em;
    color: var(--text-secondary);
    opacity: 0.7;
}

.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
}

.leaderboard-column {
    display: flex;
    flex-direction: column;
}

.leaderboard-title {
    font-size: 1.6em;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.leaderboard-item {
    background: var(--card-bg);
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.leaderboard-item:hover {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.1);
}

.leaderboard-item.first {
    background: var(--text-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow);
}

/* Keep dark background on hover for first place on desktop */
.leaderboard-item.first:hover {
    background: var(--text-primary) !important;
    color: white !important;
    box-shadow: var(--shadow) !important;
    border: none !important;
}

.leaderboard-item.second {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.leaderboard-item.third {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.leaderboard-rank {
    font-size: 1.8em;
    font-weight: 600;
    min-width: 50px;
    letter-spacing: -0.02em;
}

.leaderboard-profile {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 16px;
    position: relative;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaderboard-profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaderboard-profile-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    border-radius: 50%;
}

.leaderboard-profile-placeholder span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
    font-size: inherit;
    color: inherit;
}

.leaderboard-info {
    flex: 1;
    margin-left: 0;
    overflow: visible !important;
}

.leaderboard-name {
    font-weight: 400;
    font-size: 1.3em;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
    display: inline; /* Desktop: keep inline layout (name, country, streak) */
    overflow: visible !important;
}

/* Desktop: leaderboard-name-main should be inline so name and streak flow naturally */
.leaderboard-name-main {
    display: inline;
    overflow: visible !important;
}

.country-flag {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 8px;
    opacity: 0.8;
}

.leaderboard-details {
    margin-top: 3px;
    font-size: 1em;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.leaderboard-streak-line {
    display: inline;
}

.leaderboard-bonus-line {
    display: inline;
}

.leaderboard-separator {
    display: inline;
    color: var(--text-secondary);
    opacity: 0.5;
}

.leaderboard-stats {
    text-align: right;
}

.leaderboard-total {
    font-size: 2em;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.leaderboard-streak {
    font-size: 0.95em;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.streak-badge,
.best-set-badge,
.crown-badge {
    display: inline-block;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 400;
    margin-left: 10px;
    letter-spacing: -0.01em;
    position: relative;
    cursor: help;
    top: -3px;
    height: 21px;
    min-width: 30px;
    line-height: 16px;
    box-sizing: border-box;
    overflow: visible !important;
    z-index: 50;
    text-align: center;
}

/* Longest streak badge - blue */
.streak-badge {
    background: var(--primary-color);
}

/* Best set badge - purple/royal */
.best-set-badge {
    background: #9B59B6;
}

/* Crown badge (highest total) - golden */
.crown-badge {
    background: #FFD700;
}

.streak-badge i,
.best-set-badge i,
.crown-badge i {
    font-size: 0.7em;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* When multiple badges are shown, reduce margin on subsequent badges */
.streak-badge + .best-set-badge,
.best-set-badge + .streak-badge,
.crown-badge + .streak-badge,
.crown-badge + .best-set-badge,
.streak-badge + .crown-badge,
.best-set-badge + .crown-badge {
    margin-left: 6px;
}

.badge-group {
    display: inline-flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
    white-space: nowrap;
    margin-top: 0;
    vertical-align: middle;
}

/* Keep leaderboard name + badges tidy; if badges wrap, add row gap */
.leaderboard-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 6px;
    row-gap: 6px;
}

/* Tooltip styles */
.tooltip-trigger {
    position: relative;
    overflow: visible !important;
    cursor: help;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    z-index: 90; /* Below dashboard header (z-index: 100) but above badges (z-index: 50) */
}

/* Smooth toggle for best set fields */
.best-set-toggle {
    display: block;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.25s ease, margin 0.25s ease;
    margin-top: 0;
    margin-bottom: 0;
    pointer-events: none;
}

.best-set-toggle.visible {
    opacity: 1;
    max-height: 200px;
    margin-top: 0;
    margin-bottom: 0;
    pointer-events: auto;
}

@media (min-width: 601px) {
    .best-set-toggle.visible {
        margin-bottom: 20px;
    }
}

/* Best set validation hint */
.best-set-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease-in-out, max-height 0.4s ease-in-out;
}

.best-set-hint.visible {
    opacity: 1;
    max-height: 60px;
}

/* Generic field hint */
.field-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease-in-out, max-height 0.4s ease-in-out;
}

.field-hint.visible {
    opacity: 1;
    max-height: 60px;
}

.tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-50%) translateY(-4px);
    z-index: 95; /* Below dashboard header (z-index: 100) */
    font-weight: 400;
    letter-spacing: -0.01em;
    overflow: visible !important;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Desktop: show on hover */
@media (hover: hover) and (pointer: fine) {
    .tooltip-trigger:hover .tooltip {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
        z-index: 10000 !important;
    }
    
    /* Athlete breakdown modal: tooltips appear below */
    #athlete-breakdown-modal .tooltip-trigger:hover .tooltip {
        opacity: 1 !important;
        z-index: 100000 !important; /* Very high z-index to ensure it's above all modal elements */
    }
}

/* Mobile: show on tap, hide on outside click */
@media (hover: none) and (pointer: coarse) {
    .tooltip-trigger.active .tooltip {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
        z-index: 10000 !important;
    }
    
    /* Athlete breakdown modal: tooltips appear below */
    #athlete-breakdown-modal .tooltip-trigger.active .tooltip {
        opacity: 1 !important;
        z-index: 100000 !important; /* Very high z-index to ensure it's above all modal elements */
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Ensure confetti canvas appears above modal backdrop */
canvas[class*="confetti"],
canvas[id*="confetti"] {
    z-index: 1001 !important;
    pointer-events: none;
    position: fixed;
}

/* Target canvas elements created by canvas-confetti library */
body > canvas {
    z-index: 1001 !important;
    pointer-events: none;
    position: fixed;
}

.modal.active,
.modal[style*="display: block"],
.modal[style*="display:flex"] {
    display: flex !important;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 32px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: visible;
    box-sizing: border-box;
}

/* Profile modal specific styling */
#profile-modal .modal-content {
    padding: 28px;
    overflow-x: hidden;
}

#profile-modal .modal-body {
    overflow-x: hidden;
}

/* Invited Users Modal Styles */
.invited-users-list {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}

.invited-user-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    background: var(--bg-color);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    text-align: left;
}

.invited-user-item:hover {
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    box-shadow: var(--shadow-subtle);
}

.invited-user-item:last-child {
    margin-bottom: 0;
}

.invited-user-profile {
    position: relative;
    flex-shrink: 0;
}

.invited-user-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    /* Ensure images are cached and load instantly */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Prevent layout shift while loading */
    background: var(--bg-color);
}

.invited-user-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #d0d0d0;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    border: 2px solid var(--border-color);
}

.invited-user-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.invited-user-name {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.invited-user-name-main {
    display: inline;
}

.invited-user-name .country-flag {
    font-size: 0.85em;
    color: var(--text-secondary);
    opacity: 0.8;
}

.invited-user-meta {
    font-size: 0.9em;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.empty-invites-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 1em;
    line-height: 1.6;
}

.invite-count-clickable {
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.invite-count-clickable:hover {
    opacity: 0.8;
}

/* Pull-to-Refresh Styles */
.pull-to-refresh-indicator {
    position: absolute;
    top: -90px; /* 90px above the challenge details/challenge cards */
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    /* No background - transparent */
}

.pull-to-refresh-indicator.refreshing {
    opacity: 1;
}

.pull-to-refresh-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pull-to-refresh-indicator.refreshing .pull-to-refresh-spinner {
    opacity: 1;
}

.pull-to-refresh-text {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: -0.01em;
}

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

/* Workout Celebration Modal */
.celebration-modal-content {
    text-align: center;
    padding: 48px 40px;
    animation: celebrationFadeIn 0.4s ease-out;
}

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

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

.celebration-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    animation: celebrationPulse 1s ease-in-out infinite;
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.3);
}

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

.celebration-title {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.celebration-message {
    font-size: 1.2em;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    font-weight: 500;
}

.celebration-btn {
    margin-top: 8px;
    padding: 16px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.celebration-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.3);
}

.celebration-btn:active {
    transform: translateY(0) scale(0.98);
}

.close {
    position: absolute;
    right: 24px;
    top: 24px;
    font-size: 24px;
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

/* Close button positioned inside modal-content container */
.modal-content > .modal-close {
    z-index: 10; /* Ensure it's above other content */
}

.close:hover {
    color: var(--text-primary);
    background: var(--bg-color);
}

.entry-close {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    z-index: 10;
}

.entry-close:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

/* Share Tabs */
.share-tabs {
    display: flex;
    gap: 8px;
    margin: 24px 0 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.share-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-tab:hover {
    color: var(--primary-color);
    background: rgba(0, 122, 255, 0.04);
}

.share-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.06);
}

.share-tab i {
    font-size: 14px;
}

.share-tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
}

.share-tab-content.active {
    display: block;
}

/* Instructions Tabs (for desktop home screen instructions) */
.instructions-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.instructions-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.instructions-tab:hover {
    color: var(--primary-color);
    background: rgba(0, 122, 255, 0.04);
}

.instructions-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.06);
}

.instructions-tab-content {
    position: relative;
}

.instructions-tab-pane {
    display: none;
    animation: fadeIn 0.2s ease;
}

.instructions-tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.link-display {
    display: flex;
    gap: 12px;
    margin: 0;
}

.link-display input {
    flex: 1;
    font-size: 1em;
    padding: 14px 18px;
}

.message-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
}

.message-display textarea {
    width: 100%;
    min-height: 180px;
    font-size: 14px;
    padding: 14px 18px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    background: var(--background-color);
    color: var(--text-color);
}

.message-display textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.message-display .btn {
    align-self: flex-end;
}

/* Share modal copy buttons */
.message-display .btn-small,
.link-display .btn-small {
    background: var(--primary-color);
    color: #ffffff;
    border: 1px solid var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.18);
    transition: all 0.2s ease;
}

.message-display .btn-small:hover,
.link-display .btn-small:hover {
    background: #0066d1;
    border-color: #0066d1;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.28);
}

.help-text {
    color: var(--text-secondary);
    font-size: 1em;
    margin-top: 24px;
    text-align: center;
    letter-spacing: -0.01em;
}

@media (max-width: 600px) {
    .share-tabs {
        margin: 20px 0 16px;
    }
    
    .share-tab {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .share-tab i {
        font-size: 13px;
    }
    
    .message-display textarea {
        min-height: 160px;
        font-size: 13px;
        padding: 12px 16px;
    }
}

.share-code {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.code {
    font-size: 2.4em;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 6px;
    margin-top: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', Monaco, monospace;
    letter-spacing: -0.01em;
}

.admin-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
}

.admin-panel .btn {
    padding: 12px 20px;
    font-size: 0.9em;
    width: auto;
    margin: 0;
}

/* Admin Dashboard */
.admin-section {
    margin-bottom: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--border-color);
}

.admin-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Challenge Cards */
.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.challenge-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.challenge-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.challenge-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.challenge-card-header h4 {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.challenge-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.challenge-status.active {
    background: #34C759;
    color: white;
}

.challenge-status.upcoming {
    background: #007AFF;
    color: white;
}

.challenge-status.finished {
    background: var(--text-secondary);
    color: white;
}

.challenge-card-dates {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.6;
}

.challenge-card-dates strong {
    color: var(--text-primary);
}

.challenge-card-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

.challenge-card.active {
    border-color: #34C759;
    border-width: 2px;
}

.challenge-name-text {
    display: block;
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.admin-section h3 {
    font-size: 1.6em;
    margin-bottom: 24px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.admin-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.admin-tab {
    padding: 12px 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 400;
    transition: all 0.2s ease;
    font-family: inherit;
}

.admin-tab:hover {
    background: #FFFFFF;
    border-color: var(--primary-color);
}

.admin-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.admin-users-list {
    max-height: 600px;
    overflow-y: auto;
}

.admin-users-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.admin-user-count {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--text-primary);
}

.admin-user-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.admin-user-main {
    margin-bottom: 12px;
}

.admin-user-name {
    font-size: 1.2em;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.admin-user-id {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, monospace;
}

.admin-user-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.admin-user-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.admin-user-details div {
    letter-spacing: -0.01em;
}

.admin-user-details strong {
    color: var(--text-primary);
    font-weight: 500;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.modal-buttons .btn {
    flex: 1;
    margin: 0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.2em;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

/* Rules Screen */
.rules-content {
    margin-bottom: 32px;
}

.rule-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.rule-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.rule-item h3,
.rule-item h4 {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.rule-item h4 {
    font-size: 1.2em;
}

.rule-item p {
    font-size: 1.1em;
    color: var(--text-secondary);
    line-height: 1.6;
    letter-spacing: -0.01em;
}

@media (max-width: 600px) {
    .container,
    .dashboard-container {
        padding: 20px 16px;
    }

    #dashboard-screen {
        position: relative;
    }

    .dashboard-header {
        padding: 10px 20px;
        gap: 12px;
    }

    .dashboard-header h1 {
        font-size: 1.3em;
        flex: 1;
        min-width: 0;
    }

    .user-profile {
        flex-shrink: 0;
    }

    .profile-name {
        display: none;
    }

    .profile-info {
        gap: 8px;
        padding: 6px 10px;
    }

    .profile-menu {
        right: 0;
        left: auto;
        min-width: 180px;
    }

    .dashboard-main {
        padding: 24px 20px;
        gap: 24px;
    }

    .dashboard-challenge-info {
        display: block;
        margin-bottom: 24px;
        padding-bottom: 20px;
    }

    /* Use display: contents to flatten the structure */
    .dashboard-challenge-left {
        display: contents;
    }

    /* Dates appear first (full width, block level) */
    .dashboard-challenge-left > .dashboard-challenge-dates,
    .dashboard-challenge-left > .dashboard-user-start-date {
        display: block;
        width: 100%;
        margin-bottom: 12px;
    }

    /* Buttons appear side by side using inline-flex */
    .challenge-participants-inline {
        display: inline-flex;
        margin-top: 0;
        margin-right: 12px;
        vertical-align: middle;
    }

    .dashboard-challenge-right {
        display: inline-flex;
        margin-top: 0;
        vertical-align: middle;
    }

    /* Apply button styling to participants link on mobile */
    .challenge-participants-link {
        color: var(--primary-color);
        text-decoration: none;
        font-size: 1em;
        letter-spacing: -0.01em;
        transition: background 0.2s ease, opacity 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 8px 12px;
        border-radius: 8px;
        background: rgba(0, 122, 255, 0.06);
        cursor: pointer;
        white-space: nowrap;
    }

    .challenge-participants-link:hover {
        opacity: 0.9;
        background: rgba(0, 122, 255, 0.12);
    }

    .dashboard-action-buttons {
        grid-template-columns: 1fr;
    }

    .btn-add-entry,
    .btn-invite-friends {
        font-size: 1.1em;
        padding: 20px 24px;
    }

    /* Stats grid: 2 columns on mobile, first card spans full width */
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* First stat card (Today's Target) full width on mobile */
    .stat-card-first {
        grid-column: 1 / -1;
    }
    
    /* Reduce stat card side padding on mobile */
    .stat-card {
        padding: 32px 8px;
    }
    
    /* Leaderboard mobile layout */
    .leaderboard-item {
        padding: 16px 20px;
        position: relative;
    }
    
    .leaderboard-rank {
        min-width: 40px;
        font-size: 1.5em;
    }
    
    .leaderboard-profile {
        width: 40px;
        height: 40px;
        margin-right: 12px;
    }
    
    .leaderboard-profile-placeholder {
        font-size: 16px;
    }
    
    .leaderboard-info {
        margin-left: 0;
        flex: 1;
        min-width: 0;
        position: static;
    }
    
    /* On mobile, keep name and streak inline, stack country below */
    .leaderboard-name {
        font-size: 1.1em;
        margin-bottom: 4px;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        line-height: 1.3;
        position: static;
        gap: 0;
    }
    
    /* On mobile: reorder to show name + streak on first line, country on second line */
    /* Keep name and streak badge together on first line (mobile only) */
    .leaderboard-name-main {
        display: inline-flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 4px;
        order: 0;
    }
    
    /* Move country flag to its own line on mobile - force it to wrap to next line */
    .leaderboard-name .country-flag {
        margin-left: 0;
        margin-top: 4px;
        font-size: 0.8em;
        width: 100%;
        flex-basis: 100%;
        order: 2;
    }
    
    /* Position badges inline after user name on mobile - keep on first line with name */
    .leaderboard-item .streak-badge,
    .leaderboard-item .best-set-badge,
    .leaderboard-item .crown-badge {
        position: static !important;
        width: auto !important;
        height: auto !important;
        padding: 4px 8px !important;
        margin: 0 !important;
        margin-left: 4px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 12px !important;
        font-size: 0.7em !important;
        z-index: 1;
        flex: none;
        order: 1;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Adjust tooltip position on mobile */
    .leaderboard-item .tooltip {
        bottom: calc(100% + 12px);
        font-size: 0.7em;
        padding: 5px 8px;
    }
    
    .leaderboard-details {
        font-size: 0.9em;
        margin-top: 4px;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .leaderboard-streak-line {
        display: block;
    }
    
    .leaderboard-bonus-line {
        display: block;
    }
    
    .leaderboard-avg-line {
        display: block;
    }
    
    .leaderboard-separator {
        display: none;
    }
    
    .leaderboard-stats {
        margin-left: 8px;
        min-width: 60px;
    }
    
    .leaderboard-total {
        font-size: 1.6em;
    }
    
    .leaderboard-streak {
        font-size: 0.85em;
    }

    .leaderboard-section {
        padding: 0 20px 40px;
    }

    .notifications-section {
        padding: 0 20px 40px;
    }

    .progress-section {
        padding: 0 0 15px;
    }

    .progress-chart-wrapper {
        padding: 16px;
    }

    #progress-chart {
        height: 250px;
    }

    .leaderboard-grid {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .notifications-section {
        padding: 0 20px 40px;
    }

    .notifications-container {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .card {
        padding: 32px 24px;
        border-radius: 16px;
    }

    h1 {
        font-size: 2.4em;
    }

    h2 {
        font-size: 2em;
    }

    .goal-number {
        font-size: 3.5em;
    }

    .stat-value {
        font-size: 2.5em;
    }

    .admin-panel {
        bottom: 16px;
        right: 16px;
    }

    .admin-panel .btn {
        padding: 12px 20px;
        font-size: 0.9em;
    }

    .modal-content {
        padding: 24px 20px;
        max-height: 95vh;
    }
    
    /* Mobile form spacing - slightly tighter but still generous */
    .form-group {
        margin-bottom: 18px;
    }
    
    .name-row {
        margin-bottom: 18px;
        gap: 10px;
    }
    
    form > .btn-primary,
    form > .btn-secondary,
    form > button[type="submit"],
    form > .modal-footer,
    form > .form-footer {
        margin-top: 16px;
    }
    
    /* Ensure hidden best-set-group doesn't create extra space */
    .best-set-toggle:not(.visible) {
        margin-bottom: 0 !important;
        margin-top: 0 !important;
    }
    
    /* Reduce spacing in entry form when best-set is hidden */
    #entry-screen .form-group:not(.best-set-toggle) + .best-set-toggle:not(.visible) + button[type="submit"] {
        margin-top: 16px;
    }
    
    /* Reduce bottom margin on form-group before hidden best-set-toggle */
    #entry-screen .form-group:not(.best-set-toggle):has(+ .best-set-toggle:not(.visible)) {
        margin-bottom: 10px;
    }

    /* Keep desktop spacing unchanged */
    @media (min-width: 601px) {
        #entry-screen form > .btn-primary,
        #entry-screen form > .btn-secondary,
        #entry-screen form > button[type="submit"],
        #entry-screen form > .modal-footer,
        #entry-screen form > .form-footer {
            margin-top: 24px;
        }
    }
    
    label {
        font-size: 0.9em;
        margin-bottom: 7px;
    }
    
    .name-field label {
        font-size: 0.9em;
        margin-bottom: 7px;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    input[type="time"],
    select,
    .date-input {
        padding: 12px 14px;
        font-size: 1em;
        line-height: 1.5;
        border-radius: 8px;
        min-height: 44px; /* Ensure consistent height on mobile */
        box-sizing: border-box;
    }
    
    /* Ensure date input webkit fields match on mobile */
    .date-input::-webkit-datetime-edit-fields-wrapper {
        line-height: 1.5;
        padding: 0;
    }
    
    .date-input::-webkit-datetime-edit-text {
        line-height: 1.5;
    }
    
    .date-input::-webkit-datetime-edit-month-field,
    .date-input::-webkit-datetime-edit-day-field,
    .date-input::-webkit-datetime-edit-year-field {
        line-height: 1.5;
        padding: 0;
    }
    
    .crop-area {
        width: 280px;
        height: 280px;
    }
    
    .profile-image-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .profile-image-actions .btn {
        width: 100%;
    }
    
    .modal-body {
        max-height: calc(100vh - 180px);
    }

    .name-row {
        flex-direction: column !important;
        gap: 0;
    }

    .name-field {
        margin-bottom: 16px;
    }

    .name-field:last-child {
        margin-bottom: 0;
    }
    
    /* Social Media Accounts Mobile */
    .social-media-row {
        padding: 14px;
        margin-bottom: 12px;
    }
    
    .social-media-fields {
        flex-direction: row;
        gap: 8px;
        align-items: stretch;
    }
    
    .social-platform-field {
        flex: 0 0 120px;
        width: auto;
    }
    
    .social-handle-field {
        flex: 1;
        width: auto;
        min-width: 0;
    }
    
    .btn-remove-social {
        flex: 0 0 42px;
        width: 42px;
        min-width: 42px;
        align-self: flex-start;
    }
    
    #add-social-account-btn {
        width: auto !important;
        display: inline-flex !important;
        margin-left: 0 !important;
        margin-right: auto !important;
    }

    /* Home Screen Banner Mobile */
    .home-screen-banner {
        left: 20px;
        right: 20px;
        transform: none;
        max-width: none;
    }

    .home-screen-banner.show {
        top: 16px;
    }

    .banner-content {
        min-width: auto;
        width: 100%;
        max-width: 100%;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary-color);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 280px;
    max-width: 90%;
    text-align: center;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0;
    margin: 0;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.toast-message {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* Workout log modal */
.workout-log-modal-content {
    max-width: 750px !important;
    width: 95vw;
}

.workout-log-list {
    max-height: 60vh;
    overflow-y: auto;
}

/* Workout Log Table - matching Rep Gap table styling */
.workout-log-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.workout-log-table thead {
    background: var(--primary-color);
    color: white;
}

.workout-log-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    white-space: nowrap;
}

.workout-log-table th:nth-child(1) {
    min-width: 100px;
}

.workout-log-table th:nth-child(2),
.workout-log-table th:nth-child(3) {
    text-align: left;
    min-width: 80px;
}

.workout-log-table th:nth-child(4) {
    min-width: 60px;
    width: 60px;
}

.workout-log-table th:first-child {
    border-top-left-radius: 8px;
}

.workout-log-table th:last-child {
    border-top-right-radius: 8px;
}

.workout-log-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.workout-log-table tbody tr:last-child {
    border-bottom: none;
}

.workout-log-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.workout-log-table td {
    padding: 14px 16px;
    font-size: 0.95em;
    color: var(--text-primary);
    white-space: nowrap;
}

.workout-log-date {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.workout-log-goal {
    color: var(--text-secondary);
    text-align: left;
}

.workout-log-total {
    color: var(--text-secondary);
    text-align: left;
    white-space: normal;
}

.workout-log-total-value {
    display: block;
}

.workout-log-bonus {
    font-size: 0.85em;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 2px;
}

.workout-log-sets {
    color: var(--text-secondary);
    text-align: left;
}

.workout-log-bestset {
    color: var(--text-secondary);
    text-align: left;
}

.workout-log-actions {
    text-align: center;
}

.workout-log-actions .btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

.workout-log-edit-btn {
    position: relative;
}

.workout-log-edit-text {
    display: inline;
}

.workout-log-edit-icon {
    display: none;
}

/* Missed days modal */
.missed-days-description {
    margin-bottom: 24px;
}

.missed-days-description-text {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0;
}

.missed-days-list {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Best Sets Progress Modal */
.best-sets-progress-list {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Best Sets Progress Table */
.best-sets-progress-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.best-sets-progress-table thead {
    background: var(--primary-color);
    color: white;
}

.best-sets-progress-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    white-space: nowrap;
}

.best-sets-progress-table th:nth-child(1) {
    min-width: 120px;
}

.best-sets-progress-table th:nth-child(2) {
    text-align: right;
    min-width: 100px;
}

.best-sets-progress-table th:first-child {
    border-top-left-radius: 8px;
}

.best-sets-progress-table th:last-child {
    border-top-right-radius: 8px;
}

.best-sets-progress-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.best-sets-progress-table tbody tr:last-child {
    border-bottom: none;
}

.best-sets-progress-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.best-sets-progress-table td {
    padding: 14px 16px;
    font-size: 0.95em;
    color: var(--text-primary);
}

.best-sets-date {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.best-sets-value {
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.05em;
}

/* Streak History Modal */
.streak-history-list {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Impact Tree Modal */
.impact-tree-description {
    margin-bottom: 15px;
    padding: 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.impact-tree-container {
    max-height: 50vh;
    margin-bottom: 0px;
    padding: 0;
    background: transparent;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.impact-tree-svg-wrapper {
    width: 100%;
    height: 60vh;
    overflow: hidden;
    border-radius: 8px;
    background: #fafafa;
    position: relative;
}

#impact-tree-svg {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#impact-tree-svg:active {
    cursor: grabbing;
}

.impact-tree-link {
    fill: none;
    stroke: #d0d0d0;
    stroke-width: 2px;
}

.impact-tree-d3-node {
    cursor: pointer;
}

.impact-tree-d3-node circle {
    transition: r 0.2s ease, stroke-width 0.2s ease;
}

.impact-tree-d3-node:hover circle {
    r: 35;
    stroke-width: 4px;
}

.impact-tree-d3-node text {
    pointer-events: none;
    user-select: none;
}

.impact-tree-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.impact-tree-controls .btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 6px;
}


.impact-tree-summary {
    text-align: center;
    padding: 16px;
    background: white;
    border-radius: 8px;
    margin-top: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.impact-tree-summary p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.impact-tree-summary strong {
    color: var(--primary-color);
    font-size: 1.2em;
}

/* Mobile adjustments for Impact Tree */
@media (max-width: 600px) {
    .impact-tree-svg-wrapper {
        height: 50vh;
    }
    
    .impact-tree-controls .btn-small {
        padding: 6px 12px;
        font-size: 0.85em;
    }
}

/* Streak History Table */
.streak-history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.streak-history-table thead {
    background: var(--primary-color);
    color: white;
}

.streak-history-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    white-space: nowrap;
}

.streak-history-table th:nth-child(1) {
    min-width: 120px;
}

.streak-history-table th:nth-child(2) {
    text-align: right;
    min-width: 80px;
}

.streak-history-table th:nth-child(3) {
    text-align: center;
    min-width: 100px;
}

.streak-history-table th:first-child {
    border-top-left-radius: 8px;
}

.streak-history-table th:last-child {
    border-top-right-radius: 8px;
}

.streak-history-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.streak-history-table tbody tr:last-child {
    border-bottom: none;
}

.streak-history-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.streak-history-table td {
    padding: 14px 16px;
    font-size: 0.95em;
    color: var(--text-primary);
}

.streak-start-date {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.streak-days {
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.05em;
}

.streak-status {
    text-align: center;
}

.streak-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.streak-status-badge.current {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Rep Gap Table */
.rep-gap-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rep-gap-table thead {
    background: var(--primary-color);
    color: white;
}

.rep-gap-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.rep-gap-table th:nth-child(2),
.rep-gap-table th:nth-child(3),
.rep-gap-table th:nth-child(4) {
    text-align: right;
}

.rep-gap-table th:first-child {
    border-top-left-radius: 8px;
}

.rep-gap-table th:last-child {
    border-top-right-radius: 8px;
}

.rep-gap-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.rep-gap-table tbody tr:last-child {
    border-bottom: none;
}

.rep-gap-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.rep-gap-table td {
    padding: 14px 16px;
    font-size: 0.95em;
    color: var(--text-primary);
}

.rep-gap-date {
    font-weight: 500;
    color: var(--text-primary);
}

.rep-gap-goal {
    color: var(--text-secondary);
    text-align: right;
}

.rep-gap-logged {
    color: var(--text-secondary);
    text-align: right;
}

.rep-gap-gap {
    color: var(--primary-color);
    font-weight: 600;
    text-align: right;
}

.missed-day-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.missed-day-item:last-child {
    border-bottom: none;
}

.missed-day-date {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1em;
    margin-bottom: 4px;
}

.missed-day-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.missed-day-goal,
.missed-day-logged,
.missed-day-missed {
    display: flex;
    align-items: center;
}

.missed-day-missed {
    color: var(--primary-color);
    font-weight: 500;
}

.missed-days-total {
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    margin-top: 8px;
}

.missed-days-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.missed-days-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
}

.missed-days-summary-label {
    color: var(--text-secondary);
}

.missed-days-summary-value {
    color: var(--text-primary);
    font-weight: 500;
}

.missed-days-total-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
}

.missed-days-total-label {
    color: var(--text-secondary);
}

.missed-days-total-value {
    color: var(--primary-color);
}

.missed-pushups-link {
    cursor: pointer;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.missed-pushups-link:hover {
    opacity: 0.7;
}

@media (max-width: 600px) {
    /* Rep Gap table - mobile layout */
    .rep-gap-table {
        font-size: 0.85em;
    }
    
    .rep-gap-table th,
    .rep-gap-table td {
        padding: 10px 12px;
    }
    
    .rep-gap-table th {
        font-size: 0.8em;
    }
    
    .missed-days-description-text {
        font-size: 0.9em;
    }
    
    /* Workout log modal - mobile layout (keep same table styling as desktop) */
    .workout-log-table {
        font-size: 0.85em;
        table-layout: fixed;
        width: 100%;
    }
    
    .workout-log-table th,
    .workout-log-table td {
        padding: 10px 8px;
    }
    
    .workout-log-table th {
        font-size: 0.8em;
    }
    
    .workout-log-table th:nth-child(1),
    .workout-log-table td:nth-child(1) {
        width: 25%;
    }
    
    .workout-log-table th:nth-child(2),
    .workout-log-table td:nth-child(2) {
        width: 15%;
    }
    
    .workout-log-table th:nth-child(3),
    .workout-log-table td:nth-child(3) {
        width: 50%;
    }
    
    .workout-log-table th:nth-child(4),
    .workout-log-table td:nth-child(4) {
        width: 10%;
        min-width: 40px;
    }
    
    .workout-log-table td {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .workout-log-date {
        white-space: normal;
        font-size: 0.85em;
    }
    
    .workout-log-edit-text {
        display: none;
    }
    
    .workout-log-edit-icon {
        display: inline-block;
        font-size: 1em;
    }
    
    .workout-log-actions .btn-small {
        padding: 6px 8px;
        min-width: 32px;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Best Sets Progress table - mobile layout (keep same table styling as desktop) */
    .best-sets-progress-table {
        font-size: 0.85em;
    }
    
    .best-sets-progress-table th,
    .best-sets-progress-table td {
        padding: 10px 12px;
    }
    
    .best-sets-progress-table th {
        font-size: 0.8em;
    }
    
    /* Streak History table - mobile layout */
    .streak-history-table {
        font-size: 0.85em;
    }
    
    .streak-history-table th,
    .streak-history-table td {
        padding: 10px 12px;
    }
    
    .streak-history-table th {
        font-size: 0.8em;
    }
    
    .streak-history-table thead {
        display: none; /* Hide header on mobile */
    }
    
    .streak-history-table tbody tr {
        display: block;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 16px;
        background: var(--card-background);
        padding: 20px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        transition: box-shadow 0.2s ease, transform 0.2s ease;
    }
    
    .streak-history-table tbody tr:active {
        transform: scale(0.98);
    }
    
    .streak-history-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 12px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        text-align: left !important;
    }
    
    .streak-history-table tbody td:first-child {
        padding-top: 0;
    }
    
    .streak-history-table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
        justify-content: flex-end;
    }
    
    .streak-history-table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.8em;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 16px;
        flex-shrink: 0;
        min-width: 80px;
    }
    
    .streak-start-date:before {
        content: 'Start Date';
    }
    
    .streak-days:before {
        content: 'Days';
    }
    
    .streak-status:before {
        content: '';
    }
    
    /* Hide badges on mobile in Country Breakdown and All Participants modals */
    #country-breakdown-modal .crown-badge,
    #country-breakdown-modal .streak-badge,
    #country-breakdown-modal .best-set-badge,
    #all-participants-modal .crown-badge,
    #all-participants-modal .streak-badge,
    #all-participants-modal .best-set-badge {
        display: none !important;
    }
    }
    
/* Country breakdown modal */
#country-breakdown-modal .modal-content {
    overflow-x: hidden;
}

#country-breakdown-modal .modal-body {
    overflow-x: hidden;
}

.country-breakdown-list {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.country-breakdown-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.country-breakdown-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.country-breakdown-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
}

.country-breakdown-list-items {
    width: 100%;
}

.country-breakdown-list-items .leaderboard-item {
    margin-bottom: 12px;
}

.leaderboard-avg-line {
    display: inline;
}

/* All Participants modal - stack country and best set vertically */
#all-participants-modal .leaderboard-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

#all-participants-modal .leaderboard-country {
    display: block;
}

#all-participants-modal .leaderboard-avg-line {
    display: block;
}

.country-leaderboard-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
}

.athlete-leaderboard-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
}

/* Athlete breakdown modal - reuse existing stat-card classes */
#athlete-breakdown-modal .modal-content {
    overflow: visible !important;
}

#athlete-breakdown-modal .modal-body {
    padding: 0;
    overflow: visible !important;
    position: relative;
    text-align: center !important;
}

#athlete-breakdown-modal .athlete-breakdown-content {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: visible !important;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    text-align: left !important;
    text-align: left;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Ensure content container doesn't clip tooltips */
#athlete-breakdown-modal .athlete-breakdown-content > * {
    overflow: visible !important;
}

/* Ensure badges and tooltips in athlete breakdown modal are not clipped */
#athlete-breakdown-modal .athlete-breakdown-header,
#athlete-breakdown-modal .athlete-breakdown-name,
#athlete-breakdown-modal .streak-badge,
#athlete-breakdown-modal .best-set-badge,
#athlete-breakdown-modal .crown-badge,
#athlete-breakdown-modal .tooltip-trigger {
    position: relative !important;
    z-index: 10001 !important;
    overflow: visible !important;
}

/* Tooltip positioning in athlete breakdown modal - show below badges */
#athlete-breakdown-modal .tooltip {
    z-index: 100000 !important; /* Very high z-index to ensure it's above all modal elements */
    position: absolute !important;
    bottom: auto !important;
    top: calc(100% + 8px) !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(4px) !important;
}

/* Tooltip arrow - point up to badge (arrow at top of tooltip pointing upward) */
#athlete-breakdown-modal .tooltip::after {
    top: -5px !important;
    bottom: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border: 5px solid transparent !important;
    border-bottom-color: rgba(0, 0, 0, 0.9) !important;
    border-top: none !important;
}

#athlete-breakdown-modal .athlete-breakdown-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Profile Image Lightbox (Mobile Only) */
.profile-image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-image-lightbox.active {
    display: flex;
    opacity: 1;
}

/* Only show lightbox on mobile */
@media (min-width: 601px) {
    .profile-image-lightbox {
        display: none !important;
    }
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.lightbox-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px;
    box-sizing: border-box;
    z-index: 2;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox-close:hover,
.lightbox-close:active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-close i {
    pointer-events: none;
}

/* Desktop: Hide lightbox functionality */
@media (min-width: 601px) {
    .athlete-breakdown-profile-image {
        cursor: default !important;
        pointer-events: none !important;
    }
    
    .profile-image-lightbox {
        display: none !important;
    }
}

/* Header card with profile - scoped to modal with !important to override */
#athlete-breakdown-modal .athlete-breakdown-header {
    display: flex !important;
    align-items: center !important;
    gap: 20px !important;
    margin-bottom: 24px !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible !important;
    position: relative;
    z-index: 1;
}

#athlete-breakdown-modal .athlete-breakdown-profile {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    background: #F5F5F5 !important;
    border: 3px solid rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}

#athlete-breakdown-modal .athlete-breakdown-profile-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    border-radius: 50% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

#athlete-breakdown-modal .athlete-breakdown-profile-placeholder {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--primary-color) !important;
    color: #fff !important;
    font-size: 32px !important;
    font-weight: 600 !important;
    border-radius: 50% !important;
}

#athlete-breakdown-modal .athlete-breakdown-profile-placeholder span {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    line-height: 1 !important;
    font-size: inherit !important;
    color: inherit !important;
}

#athlete-breakdown-modal .athlete-breakdown-info {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    position: relative;
    z-index: 1;
    gap: 0 !important;
}

#athlete-breakdown-modal .athlete-breakdown-name {
    font-size: 1.8em !important;
    font-weight: 600 !important;
    color: #1D1D1F !important;
    margin: 0 0 3px 0 !important;
    line-height: 1.2 !important;
    letter-spacing: -0.01em !important;
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0 !important;
    overflow: visible !important;
    position: relative;
    z-index: 2;
}

/* Badge styling in athlete breakdown - make round and ensure not clipped */
#athlete-breakdown-modal .streak-badge,
#athlete-breakdown-modal .best-set-badge,
#athlete-breakdown-modal .crown-badge {
    margin-left: 10px !important;
    vertical-align: middle !important;
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
    position: relative !important;
}

#athlete-breakdown-modal .streak-badge i,
#athlete-breakdown-modal .best-set-badge i,
#athlete-breakdown-modal .crown-badge i {
    font-size: 0.5em !important;
    line-height: 1 !important;
}

#athlete-breakdown-modal .streak-badge + .best-set-badge,
#athlete-breakdown-modal .best-set-badge + .streak-badge,
#athlete-breakdown-modal .crown-badge + .streak-badge,
#athlete-breakdown-modal .crown-badge + .best-set-badge,
#athlete-breakdown-modal .streak-badge + .crown-badge,
#athlete-breakdown-modal .best-set-badge + .crown-badge {
    margin-left: 6px !important;
}

#athlete-breakdown-modal .athlete-breakdown-country {
    font-size: 1em !important;
    color: #86868B !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

@media (max-width: 640px) {
    #athlete-breakdown-modal .athlete-breakdown-country {
        font-size: 0.92em !important;
        line-height: 1.35 !important;
    }
}

/* Social media icons in athlete breakdown */
#athlete-breakdown-modal .athlete-social-media {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 12px 0 0 0 !important;
    padding: 0 !important;
    flex-wrap: wrap !important;
}

#athlete-breakdown-modal .athlete-social-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    font-size: 14px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    border: none !important;
    color: #FFFFFF !important;
}

/* Platform-specific colors */
#athlete-breakdown-modal .athlete-social-icon-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%) !important;
}

#athlete-breakdown-modal .athlete-social-icon-facebook {
    background: #1877F2 !important;
}

#athlete-breakdown-modal .athlete-social-icon-tiktok {
    background: #000000 !important;
}

#athlete-breakdown-modal .athlete-social-icon-x {
    background: #000000 !important;
}

#athlete-breakdown-modal .athlete-social-icon-youtube {
    background: #FF0000 !important;
}

#athlete-breakdown-modal .athlete-social-icon-linkedin {
    background: #0077B5 !important;
}

#athlete-breakdown-modal .athlete-social-icon-other {
    background: #6B7280 !important;
}

#athlete-breakdown-modal .athlete-social-icon:hover {
    transform: translateY(-2px) scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    opacity: 0.9 !important;
}

#athlete-breakdown-modal .athlete-social-icon:active {
    transform: translateY(0) scale(1.05) !important;
}

#athlete-breakdown-modal .athlete-social-icon i {
    display: inline-block !important;
    line-height: 1 !important;
}

/* Make stat cards more compact in modal */
#athlete-breakdown-modal .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#athlete-breakdown-modal .athlete-mini-chart-container {
    width: 100%;
    height: 90px;
    margin: -5px 0 -2px 0;
}

#athlete-breakdown-modal .athlete-mini-chart-container canvas {
    width: 100% !important;
    height: 90px !important;
    display: block;
}

#athlete-breakdown-modal .stat-card {
    padding: 16px 16px 8px 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Remove hover effect on stat cards in athlete breakdown on mobile only */
@media (max-width: 600px) {
    #athlete-breakdown-modal .stat-card:hover {
        border-color: var(--border-color);
        transform: none;
        box-shadow: none;
    }
}

#athlete-breakdown-modal .stat-label {
    font-size: 0.75em !important;
}

#athlete-breakdown-modal .stat-value {
    font-size: 2.2em;
}

#athlete-breakdown-modal .stat-unit {
    display: none !important;
}

/* Footer with join date and inviter info */
#athlete-breakdown-modal .athlete-breakdown-footer {
    margin-top: 25px !important;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    padding-top: 20px !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    border-top: 1px solid #e8e8e8 !important;
    border-bottom: none;
    border-left: none;
    border-right: none;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center !important;
    line-height: 1.5;
    width: 100%;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
    clear: both;
}

/* Extra specificity to beat inherited text-align rules */
#athlete-breakdown-modal .athlete-breakdown-content .athlete-breakdown-footer {
    text-align: center !important;
    padding: 0 !important;
    margin-top: 20px !important;
    display: block !important;
    border: none !important;
}


#athlete-breakdown-modal .athlete-breakdown-footer .leaderboard-separator {
    margin: 0 8px;
    display: inline-block;
    color: var(--text-secondary);
    opacity: 0.5;
}

@media (max-width: 600px) {
    /* Keep two-column grid on mobile */
    #athlete-breakdown-modal .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Mobile padding adjustments */
    #athlete-breakdown-modal .athlete-breakdown-content {
        padding: 0;
    }
    
    /* Ensure footer divider shows on mobile */
    #athlete-breakdown-modal .athlete-breakdown-footer {
        margin-top: 28px;
        padding-top: 20px;
        border-top: 1px solid var(--border-color) !important;
        display: block !important;
        font-size: 8px !important;
    }
    
    /* Keep header inline (not stacked) and left-aligned on mobile */
    #athlete-breakdown-modal .athlete-breakdown-header {
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        padding: 0 !important;
    }
    
    #athlete-breakdown-modal .athlete-breakdown-info {
        align-items: flex-start !important;
        text-align: left !important;
    }
    
    /* Ensure profile image is properly aligned on mobile */
    #athlete-breakdown-modal .athlete-breakdown-profile {
        width: 80px !important;
        height: 80px !important;
        flex-shrink: 0 !important;
        align-self: flex-start !important;
        position: relative !important;
    }
    
    #athlete-breakdown-modal .athlete-breakdown-profile-image {
        object-position: center center !important;
        object-fit: cover !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Reduce vertical padding on mobile for more compact design */
    /* Reduce bottom padding more than top to fix uneven appearance */
    #athlete-breakdown-modal .stat-card {
        padding: 14px 12px 2px 12px !important;
    }
    
    /* Reduce social icon container size by 2px on mobile, keep icon size same */
    #athlete-breakdown-modal .athlete-social-icon {
        width: 26px !important;
        height: 26px !important;
}

    .workout-log-cell:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.85em;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Invited users modal - mobile layout */
    .invited-user-name {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .invited-user-name-main {
        display: block;
    }
    
    .invited-user-name .country-flag {
        margin-left: 0;
        font-size: 0.8em;
    }
    
    .toast-notification {
        bottom: 20px;
        padding: 14px 20px;
        min-width: 260px;
        border-radius: 10px;
    }
    
    .toast-message {
        font-size: 14px;
    }
    
    .toast-icon {
        font-size: 18px;
    }
    
    /* Flip counter responsive - scale down on mobile */
    .flip-digit-card {
        width: 120px;
        height: 180px;
    }
    
    .flip-digit-content {
        font-size: 6.5em;
    }
    
    .flip-counter {
        gap: 12px;
    }
}

/* Milestones Modal - Reverse Pyramid */
.milestones-next-milestone {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.95em;
    color: var(--text-primary);
    padding: 0 20px;
}

.milestones-pyramid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0;
    min-height: 300px;
    justify-content: flex-end;
    font-size: 1em;
}

.milestones-pyramid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.milestone-level {
    position: relative;
    border-radius: 6px;
    padding: 8px 5px;
    text-align: center;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.milestone-level:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.milestone-level.achieved {
    opacity: 1;
}

.milestone-level.not-achieved {
    opacity: 0.7;
}

.milestone-level.just-achieved {
    animation: pulse 1s ease-in-out;
}

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

.milestone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 2;
    position: relative;
}

.milestone-number {
    font-size: 1.4em;
    font-weight: 700;
    line-height: 0.8;
}

.milestone-label {
    font-size: 0.9em;
    font-weight: 500;
    opacity: 0.95;
}

.milestone-divider-wrapper {
    position: relative;
    width: 100%;
    margin: 4px 0;
}

.milestone-divider {
    position: relative;
    height: 3px;
    background: rgba(255, 149, 0, 1);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 149, 0, 0.6);
    z-index: 3;
    animation: dividerGlow 2s ease-in-out infinite;
    width: 100%;
}

.milestone-divider-label {
    position: absolute;
    left: 0;
    top: -20px;
    font-size: 0.75em;
    font-weight: 500;
    color: rgba(255, 149, 0, 1);
    white-space: nowrap;
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
}

@keyframes dividerGlow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(255, 149, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 16px rgba(255, 149, 0, 0.9);
    }
}

