/* Compact Header Layout Fixes */

/* Override header height */
.game-header {
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    padding: 5px 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    overflow: visible !important;
}

/* Home button adjustment */
.home-button {
    width: 36px !important;
    height: 36px !important;
    padding: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.home-button img {
    width: 28px !important;
    height: 28px !important;
}

/* Game title - centered */
.game-title {
    font-size: 16px !important;
    margin: 0 !important;
    line-height: 1 !important;
    padding: 0 !important;
    font-weight: 600 !important;
    letter-spacing: 2px !important;
}

/* Header sections */
.header-left,
.header-center,
.header-right {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
}

.header-left {
    flex: 0 0 auto;
    gap: 10px;
}

.header-left .game-stats {
    display: flex !important;
    gap: 8px !important;
    margin-left: 10px !important;
}

.header-center {
    flex: 1 1 auto;
    justify-content: center !important;
    text-align: center !important;
}

.header-right {
    flex: 0 0 auto;
    gap: 8px;
    justify-content: flex-end;
    overflow: visible !important;
    position: relative !important;
}

/* Game stats - more compact */
.game-stats {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    height: 100% !important;
}

.stat-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 2px 8px !important;
    height: 40px !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px) !important;
}

.stat-label {
    font-size: 9px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    opacity: 0.7 !important;
    margin-bottom: 2px !important;
}

.stat-value {
    font-size: 13px !important;
    font-weight: bold !important;
    color: rgba(255, 215, 0, 0.9) !important;
}

/* Elements count specific styling */
#elements-count {
    color: rgba(255, 193, 7, 0.9) !important;
}

/* Discoveries badge - positioned better */
.discoveries-badge {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    width: 14px !important;
    height: 14px !important;
    background: rgba(255, 87, 34, 0.9) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: bold !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    animation: pulse-badge 2s ease-in-out infinite !important;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Rank display adjustments */
.clickable-rank {
    position: relative !important;
}

.clickable-rank .rank-dropdown {
    position: absolute !important;
    top: calc(100% + 5px) !important;
    left: 0 !important;
    z-index: 1000 !important;
}

.rank-display-container {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    height: 100% !important;
}

.rank-image-header {
    width: 28px !important;
    height: 28px !important;
    border-radius: 4px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 2px !important;
}

.rank-score {
    font-size: 11px !important;
    color: rgba(138, 43, 226, 0.9) !important;
    font-weight: 600 !important;
}

/* Help button styling */
.toggle-completed-button {
    background: rgba(76, 217, 100, 0.1) !important;
    border: 1px solid rgba(76, 217, 100, 0.3) !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    color: rgba(180, 255, 200, 0.9) !important;
    font-size: 13px !important;
    cursor: pointer !important;
    margin-right: 8px !important;
    transition: all 0.2s ease !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    gap: 8px !important;
}

.toggle-completed-button input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    cursor: pointer !important;
    accent-color: rgba(76, 217, 100, 1) !important;
}

.toggle-completed-button:hover {
    background: rgba(76, 217, 100, 0.2) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(76, 217, 100, 0.3) !important;
}

.toggle-completed-button.unchecked {
    background: rgba(255, 159, 64, 0.1) !important;
    border: 1px solid rgba(255, 159, 64, 0.3) !important;
    color: rgba(255, 200, 150, 0.9) !important;
}

.toggle-completed-button.unchecked input[type="checkbox"] {
    accent-color: rgba(255, 159, 64, 1) !important;
}

.help-button {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    color: rgba(255, 215, 0, 0.9) !important;
    font-size: 13px !important;
    cursor: pointer !important;
    margin-right: 8px !important;
    transition: all 0.2s ease !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
}

.help-button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.2) !important;
}

.save-button {
    background: rgba(76, 175, 80, 0.2) !important;
    border: 1px solid rgba(76, 175, 80, 0.4) !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    color: rgba(76, 175, 80, 1) !important;
    font-size: 13px !important;
    cursor: pointer !important;
    margin-right: 8px !important;
    transition: all 0.2s ease !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.save-button:hover {
    background: rgba(76, 175, 80, 0.3) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3) !important;
}

.save-button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 152, 0, 0);
    }
}

.mobile-btn-text {
    font-size: 20px !important;
    line-height: 1 !important;
}

/* Audio control button */
.audio-control {
    position: relative !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
}

.mute-button {
    width: 40px !important;
    height: 40px !important;
    padding: 6px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mute-button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px) !important;
}

.mute-button img {
    width: 28px !important;
    height: 28px !important;
}

/* Mobile header adjustments */
@media (max-width: 768px) {
    /* Hide desktop-only elements on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-only elements on mobile */
    .mobile-only {
        display: flex !important;
    }
    
    .game-header {
        height: 45px !important;
        min-height: 45px !important;
        padding: 4px 8px !important;
    }
    
    .game-title {
        font-size: 14px !important;
        letter-spacing: 1px !important;
    }
    
    .mobile-header-icons {
        display: flex !important;
        gap: 6px !important;
        align-items: center !important;
        height: 100% !important;
    }
    
    .mobile-icon-btn {
        width: 35px !important;
        height: 35px !important;
        padding: 5px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border-radius: 6px !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .mobile-btn-icon {
        width: 24px !important;
        height: 24px !important;
    }
    
    .mobile-discoveries-badge {
        top: 0 !important;
        right: 0 !important;
        width: 12px !important;
        height: 12px !important;
        font-size: 8px !important;
    }
}

/* Dropdown positioning fix */
.rank-dropdown,
.audio-dropdown {
    top: calc(100% + 5px) !important;
}

/* Fix discoveries click area */
.clickable-stat {
    position: relative !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.clickable-stat:hover {
    background: rgba(255, 193, 7, 0.15) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.clickable-stat:active {
    transform: translateY(0) !important;
}

.clickable-stat::after {
    content: '👁';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.clickable-stat:hover::after {
    opacity: 0.5;
}

/* Ensure header controls don't overflow */
.header-controls {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    gap: 8px !important;
}

/* Desktop-only elements should only show on desktop */
@media (min-width: 769px) {
    .header-left.desktop-only {
        display: flex !important;
    }
    
    .header-controls.desktop-only {
        display: flex !important;
    }
    
    /* Hide mobile-only elements on desktop */
    .mobile-only {
        display: none !important;
    }
}

/* Ensure rank dropdown positions correctly */
#rank-dropdown {
    position: absolute !important;
    top: calc(100% + 5px) !important;
    left: 0 !important;
    z-index: 1000 !important;
}

/* Rank dropdown enhancements */
.rank-item.current-rank {
    background: rgba(138, 43, 226, 0.2) !important;
    border: 1px solid rgba(138, 43, 226, 0.5) !important;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3) !important;
}

.rank-item.next-rank {
    background: rgba(255, 215, 0, 0.1) !important;
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
}

.current-score-info {
    font-size: 11px !important;
    color: rgba(138, 43, 226, 0.9) !important;
    margin-top: 4px !important;
    font-weight: bold !important;
}

.points-needed-info {
    font-size: 11px !important;
    color: rgba(255, 215, 0, 0.9) !important;
    margin-top: 4px !important;
    font-style: italic !important;
}

/* Version Badge - Top Right Corner */
.version-badge {
    display: flex;
    align-items: center;
    gap: 2px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(75, 0, 130, 0.2));
    border: 1px solid rgba(138, 43, 226, 0.4);
    border-radius: 12px;
    padding: 4px 10px;
    font-family: 'Cinzel', serif;
    cursor: default;
    user-select: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.2);
}

.version-badge:hover {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.3), rgba(75, 0, 130, 0.3));
    border-color: rgba(138, 43, 226, 0.6);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
    transform: translateY(-1px);
}

.version-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
}

.version-number {
    font-size: 13px;
    font-weight: 700;
    color: #ffd700;
    letter-spacing: 0.5px;
}

/* Mobile version badge adjustment */
@media (max-width: 768px) {
    .version-badge {
        padding: 3px 8px;
    }

    .version-label {
        font-size: 10px;
    }

    .version-number {
        font-size: 11px;
    }
}