/* Mobile-specific styles */
@media (max-width: 768px) {
    /* Hide emotions grid by default on mobile */
    .emotion-selector {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0;
        background: none;
        pointer-events: none;
        z-index: 100;
    }

    /* Emotions toggle button - positioned in right corner */
    .emotions-toggle-btn {
        display: flex;
        position: fixed;
        bottom: 35px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        pointer-events: auto;
    }

    .emotions-toggle-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
    }

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

    /* Toggle button icon */
    .emotions-toggle-btn .toggle-icon {
        font-size: 24px;
        transition: transform 0.3s ease;
    }

    /* Rotate icon when expanded */
    .emotions-toggle-btn.active .toggle-icon {
        transform: rotate(45deg);
    }

    /* Toggle button text */
    .emotions-toggle-btn .toggle-text {
        position: absolute;
        bottom: -20px;
        white-space: nowrap;
        font-size: 11px;
        color: rgba(255, 255, 255, 0.7);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Emotions panel (collapsible) */
    .emotions-panel {
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.9) 100%);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 20px;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        pointer-events: auto;
        max-height: 60vh;
        overflow-y: auto;
    }

    /* Show emotions panel when active */
    .emotions-panel.active {
        bottom: 0;
    }

    /* Question text in panel */
    .emotions-panel .question {
        text-align: center;
        font-size: 1.2rem;
        font-weight: 200;
        margin-bottom: 1.5rem;
        color: #fff;
    }

    /* Emotions grid in panel */
    .emotions-panel .emotions-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
        max-width: 100%;
        margin: 0 auto;
        opacity: 1;
        animation: none;
    }

    /* Hide original emotions selector on mobile */
    .emotion-selector .question,
    .emotion-selector .emotions-grid {
        display: none;
    }

    /* Emotion buttons in mobile panel */
    .emotions-panel .emotion-btn {
        aspect-ratio: 1;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 16px;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        color: #8b92a1;
        position: relative;
        overflow: hidden;
        min-height: 75px;
        padding: 8px;
    }

    .emotions-panel .emotion-btn:active {
        transform: scale(0.92);
        background: rgba(255, 255, 255, 0.1);
    }

    .emotions-panel .emotion-emoji {
        font-size: 1.8rem;
    }

    .emotions-panel .emotion-label {
        font-size: 0.65rem;
        text-transform: capitalize;
        letter-spacing: 0.02em;
    }

    .emotions-panel .emotion-count {
        position: absolute;
        top: 3px;
        right: 3px;
        background: rgba(255, 255, 255, 0.15);
        padding: 1px 4px;
        border-radius: 8px;
        font-size: 0.55rem;
        opacity: 0.8;
    }

    /* Backdrop overlay when emotions panel is open */
    .emotions-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 998;
        pointer-events: auto;
    }

    .emotions-backdrop.active {
        display: block;
    }

    /* Adjust other mobile elements */
    .header {
        padding: 1rem 1rem 0.75rem;
        position: relative;
        z-index: 60;
        background: linear-gradient(to bottom, rgba(13, 17, 23, 0.98) 0%, rgba(13, 17, 23, 0.9) 80%, transparent 100%);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    h1 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }

    .live-indicator {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    /* Hide original stats panel on mobile */
    .stats-panel {
        display: none;
    }

    /* Hide original mood summary on mobile */
    .mood-summary {
        display: none;
    }
    
    /* Mobile mood container */
    .mobile-mood-container {
        display: block;
        position: fixed;
        top: 140px;
        right: 10px;
        background: rgba(255, 255, 255, 0.03);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px;
        padding: 12px;
        z-index: 40;
        transition: all 0.3s ease;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        text-align: center;
        min-width: 120px;
    }
    
    .mobile-mood-label {
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: rgba(255, 255, 255, 0.5);
        margin-bottom: 4px;
    }
    
    .mobile-mood-emoji {
        font-size: 2rem;
        display: block;
        margin: 4px 0;
        filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.2));
    }
    
    .mobile-mood-text {
        font-size: 0.85rem;
        color: rgba(255, 255, 255, 0.8);
        font-weight: 300;
    }
    
    /* Mobile stats panel */
    .mobile-stats-panel {
        display: block;
        position: fixed;
        top: 140px;
        left: 10px;
        width: 50%;
        max-width: 200px;
        background: rgba(255, 255, 255, 0.03);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px;
        padding: 12px;
        z-index: 40;
        transition: all 0.3s ease;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
    
    .mobile-stats-title {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: rgba(255, 255, 255, 0.6);
        margin-bottom: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .expand-stats-btn {
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        font-size: 0.7rem;
        cursor: pointer;
        padding: 2px 8px;
        border-radius: 10px;
        transition: all 0.2s ease;
    }
    
    .expand-stats-btn:active {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-emotion-bars {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    
    .mobile-emotion-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.8rem;
    }
    
    .mobile-emotion-bar .emoji {
        width: 20px;
        text-align: center;
    }
    
    .mobile-emotion-bar .bar-container {
        flex: 1;
        height: 4px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
        overflow: hidden;
    }
    
    .mobile-emotion-bar .bar-fill {
        height: 100%;
        border-radius: 2px;
        transition: width 0.5s ease;
    }
    
    .mobile-emotion-bar .percentage {
        width: 35px;
        text-align: right;
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.75rem;
    }
    
    /* Hidden emotions (shown when expanded) */
    .mobile-emotion-bar.hidden {
        display: none;
    }
    
    .mobile-stats-panel.expanded .mobile-emotion-bar.hidden {
        display: flex;
        animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Info button remains in left corner */
    .info-button {
        bottom: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
        z-index: 100;
    }
    
    /* Share FAB button */
    .share-fab {
        z-index: 100;
    }

    /* Info menu adjustments for mobile */
    .info-menu {
        width: 85%;
        max-width: 350px;
    }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
    .emotions-panel .emotions-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .emotions-panel .emotion-btn {
        min-height: 65px;
    }

    .emotions-panel .emotion-emoji {
        font-size: 1.5rem;
    }

    .emotions-panel .emotion-label {
        font-size: 0.6rem;
    }

    /* Adjust header for very small screens */
    .header {
        padding: 0.75rem 0.75rem 0.5rem;
    }

    h1 {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }

    .live-indicator {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    /* Adjust mobile containers for small screens */
    .mobile-mood-container {
        top: 120px;
        right: 8px;
        min-width: 100px;
        padding: 10px;
    }

    .mobile-mood-emoji {
        font-size: 1.8rem;
    }

    .mobile-mood-text {
        font-size: 0.8rem;
    }

    .mobile-stats-panel {
        top: 120px;
        left: 8px;
        padding: 10px;
    }

    .mobile-stats-title {
        font-size: 0.7rem;
    }

    .mobile-emotion-bar .emoji {
        font-size: 0.85rem;
    }

    .mobile-emotion-bar .percentage {
        font-size: 0.7rem;
        width: 30px;
    }
}

/* Very small mobile devices */
@media (max-width: 360px) {
    .mobile-mood-container {
        top: 110px;
        min-width: 90px;
        padding: 8px;
    }

    .mobile-mood-emoji {
        font-size: 1.6rem;
    }

    .mobile-stats-panel {
        top: 110px;
        width: 45%;
    }

    h1 {
        font-size: 1rem;
        line-height: 1.2;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .emotions-panel {
        max-height: 80vh;
    }

    .emotions-panel .emotions-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 0.5rem;
    }

    .emotions-panel .emotion-btn {
        min-height: 60px;
    }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 769px) {
    .emotions-toggle-btn,
    .emotions-panel,
    .emotions-backdrop,
    .mobile-stats-panel,
    .mobile-mood-container {
        display: none !important;
    }
}