* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.logo {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.auth-container {
    text-align: center;
    margin-bottom: 20px;
}

.auth-btn {
    padding: 10px 20px;
    font-size: 0.9em;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.user-name {
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
}

.user-name.clickable:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.hidden {
    display: none !important;
}

.menu-screen {
    text-align: center;
    padding: 40px 20px;
}

.menu-screen h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 500px;
    margin: 0 auto 30px;
}

.menu-stats-section {
    margin-top: 40px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.menu-stats-section h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.menu-stats-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    justify-content: center;
}

.menu-stat-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.menu-stat-tab:hover {
    color: #667eea;
}

.menu-stat-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.menu-stats-content {
    position: relative;
}

.menu-stat-panel {
    display: none;
}

.menu-stat-panel.active {
    display: block;
}

.menu-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

@media (max-width: 900px) {
    .menu-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .menu-stats-grid {
        grid-template-columns: 1fr;
    }
}

.menu-stat-group {
    display: contents;
}

.menu-stat-item {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    min-width: 0;
}

.menu-stat-label {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 8px;
}

.menu-stat-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
}

.menu-btn {
    padding: 30px;
    text-align: left;
    min-width: auto;
    width: 100%;
}

.menu-btn-title {
    font-size: 1.3em;
    margin-bottom: 10px;
    font-weight: 700;
}

.menu-btn-desc {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 400;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4a5568;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(113, 128, 150, 0.4);
}

.game-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.status-display {
    text-align: center;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
}

#status-text {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.survival-instruction {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.bpm-display {
    font-size: 1.5em;
    color: #667eea;
    font-weight: bold;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 150px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-action {
    background: #48bb78;
    color: white;
}

.btn-action:hover:not(:disabled) {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

/* Mobile-specific changes for click button */
@media (max-width: 768px) {
    #click-btn {
        padding: 150px 30px !important;
        min-height: 300px;
    }
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.results {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 2px solid #667eea;
}

.results.hidden {
    display: none;
}

.score-display {
    text-align: center;
    margin-bottom: 30px;
}

.score-display h2 {
    color: #667eea;
    margin-bottom: 15px;
}

.accuracy-value {
    font-size: 3em;
    font-weight: bold;
    color: #48bb78;
}

.timeline-container {
    margin-top: 20px;
}

.timeline-container h3 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.timeline {
    position: relative;
    height: 200px;
    min-height: 200px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
}

.timeline-mark {
    position: absolute;
    width: 3px;
    top: 0;
}

.timeline-mark.metronome {
    background: #667eea;
    z-index: 2;
    height: 50%;
    top: 0;
}

.timeline-mark.player {
    background: #48bb78;
    z-index: 3;
    width: 4px;
    height: 50%;
    top: 50%;
}

.timeline-mark.player.late {
    background: #f56565;
}

.timeline-mark.player.early {
    background: #ed8936;
}

.timeline-mark-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}

.timeline-mark.metronome .timeline-mark-label {
    color: #667eea;
    top: -25px;
}

.timeline-mark.player .timeline-mark-label {
    color: #48bb78;
    bottom: -25px;
}

.timeline-mark.player.late .timeline-mark-label {
    color: #f56565;
}

.timeline-mark.player.early .timeline-mark-label {
    color: #ed8936;
}

.stats-section {
    margin-top: 40px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stats-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.stat-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.stat-tab:hover {
    color: #667eea;
}

.stat-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.stats-content {
    position: relative;
}

.stat-panel {
    display: none;
}

.stat-panel.active {
    display: block;
}

.stats-section h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    justify-items: center;
}

.stats-grid .stat-group.hidden {
    display: none;
}

.stat-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Position items in grid: Games Played (1), Best (2), Best Rank (3), Average (4), Average Rank (5) */
.stat-group .stat-item:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

.stat-group .stat-item:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.stat-group .stat-item:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.stat-group .stat-item:nth-child(4) {
    grid-column: 3;
    grid-row: 1;
}

.stat-group .stat-item:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
}

.survival-display {
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.survival-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.survival-label {
    font-size: 1.1em;
    color: #666;
    font-weight: 600;
}

.survival-count {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
}

.survival-value {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
}

.reaction-display {
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.reaction-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.reaction-status-text {
    font-size: 1.5em;
    font-weight: 600;
    color: #667eea;
}

.reaction-status-text.too-soon {
    color: #f56565;
}

.reaction-time {
    font-size: 2.5em;
    font-weight: bold;
    color: #48bb78;
}

.reaction-value {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
}

.stat-item {
    margin-bottom: 0;
}

.stat-label {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px 15px;
        border-radius: 15px;
    }
    
    .logo {
        max-width: 150px;
    }
    
    .subtitle {
        font-size: 1em;
        margin-bottom: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    h2 {
        font-size: 1.5em;
    }
    
    .btn {
        width: 100%;
        min-width: auto;
        padding: 12px 20px;
        font-size: 1em;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .menu-screen {
        padding: 20px 10px;
    }
    
    .menu-screen h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .menu-btn {
        padding: 20px;
    }
    
    .menu-btn-title {
        font-size: 1.1em;
    }
    
    .menu-btn-desc {
        font-size: 0.85em;
    }
    
    .game-area {
        gap: 20px;
    }
    
    .status-display {
        padding: 15px;
    }
    
    #status-text {
        font-size: 1em;
    }
    
    .bpm-display {
        font-size: 1.2em;
    }
    
    .stats-section {
        padding: 15px;
    }
    
    .stats-section h3 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .stats-tabs {
        gap: 5px;
    }
    
    .stat-tab {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-item {
        padding: 8px;
        font-size: 0.85em;
    }
    
    .stat-label {
        font-size: 0.75em;
    }
    
    .stat-value {
        font-size: 1.1em;
    }
    
    .accuracy-value,
    .survival-value,
    .reaction-value {
        font-size: 2em;
    }
    
    .survival-count {
        font-size: 2em;
    }
    
    .reaction-status-text {
        font-size: 1.2em;
    }
    
    .reaction-time {
        font-size: 2em;
    }
    
    .timeline {
        height: 150px;
        min-height: 150px;
        padding: 15px 10px;
    }
    
    .results {
        padding: 15px;
    }
    
    .score-display h2 {
        font-size: 1.3em;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 15px 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }
    
    .profile-header .profile-info {
        text-align: center;
        width: 100%;
    }
    
    .profile-name-container {
        justify-content: center;
    }
    
    .profile-name {
        font-size: 1.3em;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .profile-email,
    .profile-date-joined,
    .profile-country {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .profile-actions {
        width: 100%;
        align-items: stretch;
    }
    
    .profile-action-btn {
        width: 100%;
    }
    
    .profile-stats-section {
        padding: 15px;
        margin-top: 20px;
    }
    
    .profile-stats-section h3 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .profile-stats-tabs {
        gap: 5px;
    }
    
    .profile-stat-tab {
        padding: 8px 15px;
        font-size: 0.85em;
    }
    
    .profile-stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .profile-stat-group {
        padding: 15px;
    }
    
    .profile-stat-group h4 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .profile-name-input {
        font-size: 1.2em;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 15px 10px;
        border-radius: 10px;
    }
    
    .logo {
        max-width: 120px;
    }
    
    .subtitle {
        font-size: 0.9em;
        margin-bottom: 15px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .user-name {
        font-size: 0.85em;
    }
    
    .btn-google-signin {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .google-icon {
        width: 16px;
        height: 16px;
    }
    
    .profile-avatar {
        width: 60px;
        height: 60px;
    }
    
    .profile-name {
        font-size: 1.2em;
    }
    
    .profile-email {
        font-size: 0.85em;
    }
    
    .profile-date-joined,
    .profile-country {
        font-size: 0.8em;
    }
    
    .menu-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Profile Screen Styles */
.profile-screen {
    text-align: center;
    padding: 40px 20px;
}

.profile-screen h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.profile-signed-out {
    margin: 60px 0;
}

.profile-signin-prompt {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

.btn-google-signin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.btn-google-signin:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: #f8f9fa;
}

.btn-google-signin:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.profile-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 40px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    flex-wrap: wrap;
}

.profile-header .profile-info {
    flex: 1;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #667eea;
}

.profile-info {
    text-align: left;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.profile-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    min-width: 0;
    width: 100%;
}

.profile-name {
    color: #667eea;
    font-size: 1.5em;
    margin: 0;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.profile-edit-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.profile-edit-btn:hover {
    color: #667eea;
    background: #f0f0f0;
    opacity: 1;
}

.profile-name-edit-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    width: 100%;
    flex-wrap: wrap;
}

.profile-name-edit-container.hidden {
    display: none;
}

.profile-name-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.profile-name-input:focus {
    border-color: #764ba2;
}

.profile-name-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.profile-name-action-btn.save-btn {
    color: #34a853;
}

.profile-name-action-btn.save-btn:hover {
    background: #e8f5e9;
}

.profile-name-action-btn.cancel-btn {
    color: #ea4335;
}

.profile-name-action-btn.cancel-btn:hover {
    background: #fce8e6;
}

.profile-email {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.profile-date-joined {
    color: #999;
    font-size: 0.85em;
    margin-bottom: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.profile-country {
    color: #999;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    flex-shrink: 0;
}

.profile-action-btn {
    padding: 8px 16px;
    font-size: 0.85em;
    white-space: nowrap;
}

.profile-stats-section {
    margin-top: 40px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.profile-stats-section h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.profile-stats-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    justify-content: center;
}

.profile-stat-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.profile-stat-tab:hover {
    color: #667eea;
}

.profile-stat-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.profile-stats-content {
    position: relative;
}

.profile-stat-panel {
    display: none;
}

.profile-stat-panel.active {
    display: block;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.profile-stat-group {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.profile-stat-group h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.profile-stat-item {
    margin-bottom: 0;
}

/* Position items in grid: Games Played (1), Best (2), Best Rank (3), Average (4), Average Rank (5) */
.profile-stat-item:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

.profile-stat-item:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.profile-stat-item:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.profile-stat-item:nth-child(4) {
    grid-column: 3;
    grid-row: 1;
}

.profile-stat-item:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
}

.profile-stat-label {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 5px;
}

.profile-stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

@media (max-width: 900px) {
    .profile-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Leaderboard Styles */
.leaderboard-section {
    margin-top: 40px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.leaderboard-section h3 {
    color: #667eea;
    margin-bottom: 25px;
    font-size: 1.8em;
    text-align: center;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    justify-content: center;
}

.leaderboard-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.leaderboard-tab:hover {
    color: #667eea;
}

.leaderboard-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}


.leaderboard-content {
    position: relative;
}

.leaderboard-panel {
    display: none;
}

.leaderboard-panel.active {
    display: block;
}

.leaderboard-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.leaderboard-item {
    flex: 1;
    min-width: 0;
    background: white;
    border-radius: 10px;
    padding: 15px;
}

.leaderboard-title {
    color: #667eea;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.leaderboard-item.placeholder {
    opacity: 0.6;
}

.leaderboard-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 5px;
    margin-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
    color: #667eea;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-header-rank {
    width: 50px;
    min-width: 50px;
    flex-shrink: 0;
    text-align: center;
}

.leaderboard-header-score {
    width: 60px;
    min-width: 60px;
    flex-shrink: 0;
    text-align: center;
}

.leaderboard-header-user {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.leaderboard-list {
    min-height: 200px;
}

.leaderboard-loading {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}

.leaderboard-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 5px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: #f9f9f9;
    transition: background 0.2s ease;
    min-height: 60px;
    box-sizing: border-box;
}

.leaderboard-entry:hover {
    background: #f0f0f0;
}

.leaderboard-rank {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
    width: 50px;
    min-width: 50px;
    flex-shrink: 0;
    text-align: center;
    padding-top: 0;
    line-height: 1.2;
}

.leaderboard-score {
    font-weight: 600;
    color: #333;
    width: 60px;
    min-width: 60px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.95em;
    padding-top: 0;
    line-height: 1.2;
}

.leaderboard-user-column {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    flex-shrink: 1;
    padding-top: 0;
}

.leaderboard-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
    flex-shrink: 0;
    margin-top: 0;
}

.leaderboard-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 2px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.8em;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 0;
}

.leaderboard-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.leaderboard-username {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-country {
    font-size: 0.8em;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}

@media (max-width: 900px) {
    .leaderboard-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .leaderboard-item {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .leaderboard-section {
        padding: 15px;
        margin-top: 30px;
    }
    
    .leaderboard-section h3 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .leaderboard-tabs {
        gap: 5px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .leaderboard-tab {
        padding: 8px 12px;
        font-size: 0.85em;
        flex: 1;
        min-width: 0;
    }
    
    
    .leaderboard-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .leaderboard-item {
        padding: 12px;
        width: 100%;
    }
    
    .leaderboard-title {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .leaderboard-header {
        padding: 6px 4px;
        font-size: 0.75em;
        gap: 6px;
    }
    
    .leaderboard-header-rank {
        width: 45px;
        min-width: 45px;
        font-size: 0.7em;
    }
    
    .leaderboard-header-score {
        width: 50px;
        min-width: 50px;
        font-size: 0.7em;
    }
    
    .leaderboard-header-user {
        flex: 1;
        min-width: 0;
        font-size: 0.7em;
    }
    
    .leaderboard-entry {
        padding: 6px 4px;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .leaderboard-rank {
        width: 45px;
        min-width: 45px;
        font-size: 0.9em;
    }
    
    .leaderboard-score {
        width: 50px;
        min-width: 50px;
        font-size: 0.85em;
    }
    
    .leaderboard-user-column {
        flex: 1;
        min-width: 0;
        justify-content: center;
        gap: 6px;
    }
    
    .leaderboard-avatar,
    .leaderboard-avatar-placeholder {
        width: 24px;
        height: 24px;
    }
    
    .leaderboard-username {
        font-size: 0.8em;
    }
    
    .leaderboard-country {
        font-size: 0.7em;
    }
    
    .leaderboard-list {
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .leaderboard-section {
        padding: 12px;
        margin-top: 20px;
    }
    
    .leaderboard-section h3 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .leaderboard-tab {
        padding: 6px 10px;
        font-size: 0.8em;
    }
    
    
    .leaderboard-item {
        padding: 10px;
    }
    
    .leaderboard-title {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .leaderboard-header {
        padding: 6px 2px;
        font-size: 0.7em;
        gap: 2px;
    }
    
    .leaderboard-header-rank {
        width: 40px;
        min-width: 40px;
    }
    
    .leaderboard-header-score {
        width: 45px;
        min-width: 45px;
    }
    
    .leaderboard-header-user {
        flex: 1;
        min-width: 0;
    }
    
    .leaderboard-entry {
        padding: 6px 2px;
        gap: 4px;
    }
    
    .leaderboard-rank {
        width: 40px;
        min-width: 40px;
        font-size: 0.85em;
    }
    
    .leaderboard-score {
        width: 45px;
        min-width: 45px;
        font-size: 0.8em;
    }
    
    .leaderboard-avatar,
    .leaderboard-avatar-placeholder {
        width: 20px;
        height: 20px;
    }
    
    .leaderboard-username {
        font-size: 0.75em;
    }
    
    .leaderboard-country {
        font-size: 0.65em;
    }
}

