/* Pokemon GO XP Tracker - Mobile Responsive Styles */
/* Optimized for mobile, tablet, and desktop viewports */

/* ====================================
   TABLET & MOBILE BREAKPOINT - 768px
   ==================================== */
@media (max-width: 768px) {
    /* Mobile Visibility Controls */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    /* Keep header user info visible on all screen sizes */
    .desktop-user-info {
        display: flex !important;
    }
    
    /* Show hamburger menu */
    .hamburger-menu {
        display: flex !important;
    }

    /* Hide default navigation pills on mobile */
    .nav-pills {
        display: none;
    }

    /* Hide desktop navigation on mobile - only show mobile menu overlay */
    .nintendo-nav {
        display: none !important;
    }

    .nav-container {
        position: fixed;
        top: 0;
        right: -200px; /* Start off-screen */
        width: 200px; /* Reduced to 200px */
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        box-shadow: -2px 0 20px rgba(0, 0, 0, 0.15);
        transition: all 0.4s ease-in-out;
        padding: 80px 12px 24px 12px; /* Reduced padding for narrower menu */
        visibility: hidden;
        display: flex;
        flex-direction: column;
        align-items: center; /* Center align items */
        justify-content: flex-start; /* Align from top */
        overflow-y: auto;
        z-index: 999;
    }

    .nav-container.show {
        right: 0;
        visibility: visible;
    }

    /* Hide hamburger menu when navigation is open */
    body.menu-open .hamburger-menu {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .nav-container.show .nav-pills {
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
        align-items: center; /* Center align the nav-pills container */
    }

    .nav-pill {
        width: 90%; /* Slightly smaller width for better centering */
        padding: 14px 16px; /* Adjusted padding for narrower menu */
        text-align: center; /* Center align text */
        justify-content: center; /* Center justify content */
        font-size: 15px; /* Slightly smaller font for 200px width */
        font-weight: 600;
        border-radius: 10px;
        min-height: 48px; /* Slightly smaller height */
        display: flex;
        align-items: center;
    }

    /* Prevent horizontal overflow on mobile */
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .main-content {
        overflow-x: hidden;
        max-width: 100%;
        padding: 16px 12px;
    }
    
    .content-section {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    /* Ensure all cards fit within viewport */
    .nintendo-card {
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    /* Layout Height Adjustments for Mobile */
    :root {
        --header-height: 90px; /* Increased for mobile due to flex-column layout */
        --nav-height: 64px; /* Same as desktop */
        --footer-height: auto; /* Auto height for dynamic content */
    }
    
    /* Footer Mobile Layout */
    .page-footer {
        height: auto;
        padding: 16px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .copyright-text {
        font-size: 0.875rem;
        order: 2;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
        order: 1;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    /* Header Mobile Layout */
    .nintendo-header {
        padding: 8px 16px;
        height: auto;
        min-height: var(--header-height);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1000;
    }
    
    .header-content {
        flex-direction: row;
        gap: 8px;
        justify-content: space-between;
        align-items: center;
        min-height: var(--header-height);
    }

    /* Modern Menu Overlay */
    .menu-overlay {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease-in-out;
        z-index: 1000;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .menu-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    /* Mobile Menu Content */
    .menu-content {
        width: 100%;
        max-width: 340px;
    }

    .menu-navigation {
        padding: 20px 16px;
    }

    .menu-nav-item {
        padding: 14px 16px;
        font-size: 15px;
    }

    .nav-icon {
        font-size: 18px;
        width: 22px;
    }

    .menu-quick-actions {
        padding: 16px;
    }
    
    /* Header Actions Mobile Layout */
    .header-actions {
        gap: 8px;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }
    
    /* Hide info icon on mobile */
    .info-icon-container {
        display: none;
    }
    
    .logo-section {
        gap: 8px;
    }
    
    .logo-circle {
        width: 50px;
        height: 32px;
        border-radius: 20px;
    }
    
    .pogo-logo {
        width: 40px;
        height: 30px;
    }
    
    .logo-fallback {
        font-size: 18px;
    }
    
    /* Typography Mobile Adjustments */
    .app-title {
        font-size: 20px;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    /* Header Actions Mobile Layout */
    .header-actions {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Logo Mobile Structure - Optimized for mobile view */
    .text-logo {
        gap: 1px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }
    
    .logo-poke {
        font-size: 13px;
        font-weight: 700;
        padding: 6px 8px 6px 10px;
        letter-spacing: -0.2px;
    }
    
    .logo-xplanner {
        font-size: 14px;
        font-weight: 700;
        padding: 6px 10px 6px 32px;
        letter-spacing: 0.1px;
        border-width: 2px;
    }
    
    .logo-xplanner::before {
        font-size: 22px;
        left: 4px;
        font-weight: 800;
        letter-spacing: -0.5px;
        /* Ensure animation continues on mobile */
        /* animation: xpPulse 2s ease-in-out infinite !important; */
    }

    /* Player Badge Mobile Sizing - Match hamburger menu height (40px) */
    .pill-badge-lv1 {
        height: 40px;
        font-size: 14px;
        min-width: 0;
        max-width: 240px;
        padding: 8px 12px;
    }
    
    .pill-name-lv1 {
        padding: 8px 14px;
        font-size: 14px;
        max-width: 135px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex-shrink: 1;
        min-width: 0;
        font-weight: 700;
    }
    
    .pill-level-red {
        padding: 8px 10px;
        font-size: 13px;
        flex-shrink: 0;
        white-space: nowrap;
        font-weight: 800;
    }
    
    /* Player Display Mobile Constraints */
    #playerDisplay {
        max-width: 250px;
        min-width: 0;
        flex-shrink: 1;
    }
    
    /* Info Icon Mobile Sizing */
    .info-icon-container {
        position: relative;
    }
    
    .info-icon {
        width: 32px;
        height: 32px;
    }
    
    /* Grid Layout - Maintain flex layout for better responsiveness */
    .nintendo-grid {
        gap: 16px;
        justify-content: center;
    }
    
    /* Cards maintain side-by-side on tablet and larger mobile */
    .nintendo-card.half-width {
        flex: 0 1 calc(50% - 8px);
        min-width: 280px;
    }
    
    /* Tasks card responsive width matching */
    .nintendo-card.tasks-card {
        width: 100%;
        max-width: 100%;
    }
    
    /* Navigation Mobile Layout */
    .nintendo-nav {
        padding: 12px 16px;
        height: auto;
        min-height: var(--nav-height);
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        width: 100%;
        z-index: 999;
    }
    
    .nav-pills {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .nav-pill {
        flex: 1;
        min-width: 140px;
        max-width: 180px;
        padding: 10px 16px;
        font-size: 13px;
        justify-content: center;
    }
    
    .pill-text {
        white-space: nowrap;
        /* Removed text truncation to show full text */
    }
    
    /* Main Content Mobile Spacing */
    .main-content {
        padding: 24px 16px;
        padding-top: calc(var(--header-height) + var(--nav-height) + 24px);
        min-height: 100vh;
    }
    
    /* Player Badge Mobile Ordering */
    .player-badge {
        order: -1;
    }
    
    /* Next Level Progress Mobile Layout */
    .next-level-progress-compact {
        padding: 10px 12px;
        margin-top: 10px;
    }
    
    .compact-next-level {
        flex-direction: column;
        gap: 8px;
        font-size: 0.85rem;
        align-items: stretch;
    }
    
    .compact-level-title {
        min-width: unset;
        flex-shrink: 1;
        text-align: center;
        font-size: 0.9rem;
    }
    
    .compact-progress-container {
        gap: 6px;
        flex-direction: column;
    }
    
    .compact-progress-bar {
        min-width: unset;
        width: 100%;
    }
    
    .compact-percentage,
    .compact-xp {
        min-width: unset;
        text-align: center;
        font-size: 0.8rem;
    }
    
    /* Tasks Section Mobile Layout */
    .task-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Card Header Mobile Layout */
    .card-header {
        padding: 12px 16px 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .card-title-group {
        width: 100%;
        margin-bottom: 0;
    }
    
    .card-actions {
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .card-actions .nintendo-button {
        flex: 1;
        min-width: calc(33.333% - 6px);
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    /* Progress Log Items Mobile */
    .calculation-item {
        padding: 12px 16px;
        margin-bottom: 12px;
    }
    
    .calc-header {
        margin-bottom: 10px !important;
        gap: 8px !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        flex-direction: row !important;
    }
    
    .calc-main-info {
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
        flex: 0 1 auto !important;
        min-width: 0;
    }
    
    .calc-date {
        font-size: 0.8rem;
        font-weight: 600;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .calc-date::before {
        font-size: 0.7rem;
    }
    
    .calc-actions {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
        flex-direction: row !important;
    }
    
    .calc-level {
        font-size: 0.75rem;
        padding: 4px 8px;
        border-radius: 10px;
        white-space: nowrap;
    }
    
    .delete-btn {
        min-width: 28px;
        height: 28px;
        padding: 4px 6px;
        font-size: 0.8rem;
    }
    
    .calc-details {
        padding: 10px 12px;
    }
    
    .calc-row {
        font-size: 0.8rem;
        padding: 2px 0;
    }
    
    .calc-label::before {
        font-size: 0.7rem;
    }
    
    .calc-value {
        font-size: 0.85rem;
    }

    /* Timeline Content Mobile */
    .timeline-content-modern {
        padding: 16px;
    }
    
    /* Timeline Stats Mobile */
    .timeline-stats {
        padding: 16px;
        gap: 12px;
    }
    
    .timeline-stat {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .timeline-stat-label {
        font-size: 0.8rem;
    }
    
    .timeline-stat-value {
        font-size: 1rem;
    }
    
    /* Calculation History Mobile Layout */
    .calc-details {
        grid-template-columns: 1fr;
    }
    
    .calc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* XP Guide Mobile Layout */
    
    /* Pro Tips Accordion Mobile */
    .pro-tips-accordion .accordion-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .accordion-title {
        gap: 10px;
    }
    
    .accordion-title .category-icon {
        width: 28px;
        height: 28px;
        font-size: 1.2rem;
    }
    
    .accordion-title h3 {
        font-size: 1.1rem;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .tip-item {
        padding: 16px;
    }
    
    .tip-content h4 {
        font-size: 1rem;
    }
    
    .tip-content li {
        font-size: 0.85rem;
        padding: 4px 0 4px 16px;
    }
    
    /* XP Table Mobile Layout */
    .table-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .table-controls {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .sort-controls,
    .filter-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .sort-controls select,
    .filter-controls select {
        flex: 1;
        max-width: 200px;
    }
    
    /* Mobile table - stack columns */
    .xp-table {
        font-size: 0.85rem;
    }
    
    .xp-table th,
    .xp-table td {
        padding: 12px 8px;
    }
    
    .task-col {
        width: 40%;
        font-size: 0.85rem;
    }
    
    .activity-col {
        width: 25%;
    }
    
    .xp-col,
    .lucky-egg-col {
        width: 17.5%;
        font-size: 0.8rem;
    }
    
    .activity-badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    /* Pro Tips Mobile Layout */
    .tips-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .tip-card {
        padding: 20px;
    }
    
    .tip-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
    
    .tip-card h3 {
        font-size: 1.2rem;
    }
    
    .tip-card li {
        font-size: 0.9rem;
        padding: 6px 0 6px 20px;
    }
    
    /* Footer Mobile Layout */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .footer-left {
        justify-content: center;
    }

    /* Scroll to Top Button Mobile - Hidden on mobile devices */
    .scroll-to-top,
    #scrollToTop,
    .scroll-to-top.visible,
    #scrollToTop.visible,
    button.scroll-to-top,
    button#scrollToTop,
    button.scroll-to-top.visible,
    button#scrollToTop.visible {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* ====================================
   DESKTOP - 769px AND ABOVE
   ==================================== */
@media (min-width: 769px) {
    /* Desktop Visibility Controls */
    .desktop-only {
        display: flex !important;
    }
    
    .mobile-only {
        display: none !important;
    }
    
    .desktop-user-info {
        display: flex !important;
    }
    
    /* Hide hamburger menu on desktop */
    .hamburger-menu {
        display: none !important;
    }
    
    /* Show desktop navigation, hide mobile menu overlay */
    .nintendo-nav {
        display: flex !important;
        position: static;
    }
    
    .menu-overlay {
        display: none !important;
    }
}

/* ====================================
   LARGE MOBILE - 481px TO 640px
   ==================================== */
@media (max-width: 640px) and (min-width: 481px) {
    /* Intermediate mobile size - wider cards */
    .nintendo-grid {
        gap: 14px;
        padding: 0 12px;
    }
    
    .nintendo-card.half-width {
        flex: 1 1 90%;
        min-width: unset;
        width: 90%;
        max-width: 90%;
        margin: 0 auto;
    }
    
    /* Tasks card matching width */
    .nintendo-card.tasks-card {
        flex: 1 1 90%;
        width: 90%;
        max-width: 90%;
        margin: 18px auto 0;
    }
    
    /* Next Level Progress Large Mobile */
    .next-level-progress-compact {
        padding: 10px 14px;
        margin-top: 10px;
    }
    
    .compact-next-level {
        font-size: 0.85rem;
        gap: 8px;
    }
    
    .compact-level-title {
        font-size: 0.9rem;
        min-width: 90px;
    }
    
    .compact-progress-container {
        gap: 6px;
    }
    
    .compact-percentage,
    .compact-xp {
        font-size: 0.8rem;
        min-width: 80px;
    }
    
    /* Card Header Large Mobile */
    .task-row-header {
        padding: 14px 18px;
    }
    
    /* Timeline Large Mobile */
    .timeline-dashboard {
        gap: 18px;
    }
    
    .milestone-item {
        padding: 12px 16px;
        min-height: 50px;
    }
    
    .milestone-level {
        font-size: 1rem;
    }
    
    .milestone-date {
        font-size: 0.85rem;
    }
    
    /* Card Header Large Mobile */
    .card-actions .nintendo-button {
        font-size: 0.9rem;
        padding: 9px 14px;
    }
    
    /* Progress Log Large Mobile */
    .calc-date {
        font-size: 0.85rem;
    }
    
    .calc-actions {
        gap: 10px;
    }
    
    .calc-level {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .delete-btn {
        min-width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .timeline-stats {
        padding: 18px;
        gap: 14px;
    }
}

/* ====================================
   MOBILE BREAKPOINT - 480px
   ==================================== */
@media (max-width: 480px) {
    /* Header Ultra Mobile Optimization */
    .nintendo-header {
        padding: 6px 12px;
    }
    
    .header-content {
        gap: 6px;
        justify-content: space-between;
    }
    
    /* Logo Section Mobile - Keep horizontal layout */
    .logo-section {
        gap: 6px;
        flex-direction: row;
        align-items: center;
    }
    
    .logo-circle {
        width: 45px;
        height: 28px;
        border-radius: 18px;
    }
    
    .pogo-logo {
        width: 35px;
        height: 25px;
    }
    
    .logo-fallback {
        font-size: 16px;
    }
    
    .app-title {
        font-size: 18px;
    }
    
    .title-group {
        align-items: center;
    }
    
    /* Header Actions Ultra Mobile */
    .header-actions {
        gap: 6px;
    }
    
    /* Ensure info icon stays hidden on ultra mobile */
    .info-icon-container {
        display: none;
    }
    
    /* Player Badge Ultra Mobile - Maintain consistent height */
    .pill-badge-lv1 {
        height: 36px;
        font-size: 12px;
        max-width: 200px;
        padding: 6px 10px;
        margin-right: 10px;
    }
    
    .pill-name-lv1 {
        padding: 6px 10px;
        font-size: 13px;
        max-width: 110px;
        font-weight: 700;
    }
    
    .pill-level-red {
        padding: 2px 8px;
        font-size: 12px;
        font-weight: 800;
    }
    
    #playerDisplay {
        max-width: 230px;
    }
    
    /* Navigation Ultra Mobile */
    .nintendo-nav {
        padding: 8px 12px;
         display: none;
    }
    
    .nav-pills {
        gap: 6px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-pill {
        flex: none;
        min-width: 100px;
        max-width: 130px;
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .pill-text {
        font-size: 11px;
        /* Removed text truncation for better readability */
    }
    
    /* Progress Stats Mobile Spacing */
    .progress-stats {
        gap: 12px;
    }
    
    .stat-row {
        padding: 12px;
    }
    
    .progress-percentage {
        font-size: 20px;
    }
    
    /* Next Level Progress Ultra Mobile */
    .next-level-progress-compact {
        padding: 8px 10px;
        margin-top: 8px;
        border-width: 1px;
    }
    
    .compact-next-level {
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .compact-level-title {
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    .compact-progress-bar {
        height: 6px;
    }
    
    .compact-percentage,
    .compact-xp {
        font-size: 0.75rem;
    }
    
    /* Grid Layout - Single column for ultra-small screens with wider cards */
    .nintendo-grid {
        gap: 12px;
        padding: 0 8px;
    }
    
    .nintendo-card.half-width {
        flex: 1 1 95%;
        min-width: unset;
        width: 95%;
        max-width: 95%;
        margin: 0 auto;
    }
    
    /* Tasks card matching width for consistency */
    .nintendo-card.tasks-card {
        flex: 1 1 95%;
        width: 95%;
        max-width: 95%;
        margin: 18px auto 0;
    }
    
    /* Level Badge Mobile Size */
    .level-badge {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    /* Modal Mobile Optimization */
    .nintendo-modal-content {
        width: 95%;
        max-width: 400px;
        margin: 10px;
        max-height: 85vh;
    }
    
    .nintendo-modal.show {
        padding: 0;
        align-items: center;
        justify-content: center;
    }
    
    /* Pro Tips Mobile Compact Layout */
    .pro-tips-section {
        margin-top: 24px;
        padding-top: 24px;
    }
    
    .tip-card {
        padding: 16px;
    }
    
    .tip-card h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    /* Timeline Ultra Mobile */
    .timeline-dashboard {
        gap: 16px;
    }
    
    .milestone-item {
        padding: 8px 12px;
        min-height: 40px;
        gap: 6px;
    }
    
    .milestone-level {
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    .milestone-date {
        font-size: 0.75rem;
    }
    
    /* Card Header Ultra Mobile */
    .card-header {
        padding: 10px 12px 6px;
        gap: 10px;
    }
    
    .card-actions {
        gap: 6px;
    }
    
    .card-actions .nintendo-button {
        font-size: 0.8rem;
        padding: 7px 10px;
        min-width: calc(33.333% - 4px);
    }
    
    /* Progress Log Ultra Mobile */
    .calculation-item {
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    
    .calc-header {
        margin-bottom: 8px !important;
        gap: 6px !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        flex-direction: row !important;
    }
    
    .calc-main-info {
        gap: 8px !important;
        flex: 0 1 auto !important;
        flex-direction: row !important;
        align-items: center !important;
    }
    
    .calc-actions {
        gap: 6px !important;
        flex-shrink: 0 !important;
        flex-direction: row !important;
        align-items: center !important;
    }
    
    .calc-date {
        font-size: 0.75rem;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .calc-date::before {
        font-size: 0.65rem;
    }
    
    .calc-level {
        font-size: 0.7rem;
        padding: 3px 6px;
        border-radius: 8px;
    }
    
    .delete-btn {
        min-width: 24px;
        height: 24px;
        padding: 2px 4px;
        font-size: 0.75rem;
    }
    
    .calc-details {
        padding: 8px 10px;
    }
    
    .calc-row {
        font-size: 0.75rem;
    }
    
    .calc-value {
        font-size: 0.8rem;
    }

    .timeline-content-modern {
        padding: 12px;
    }    .timeline-stats {
        padding: 12px;
        gap: 10px;
    }
    
    .timeline-stat {
        padding: 8px 10px;
        gap: 2px;
    }
    
    .timeline-stat-label {
        font-size: 0.75rem;
    }
    
    .timeline-stat-value {
        font-size: 0.9rem;
    }
    
    /* Timeline Badge Ultra Mobile */
    .timeline-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    /* Empty State Ultra Mobile */
    .empty-state h4 {
        font-size: 1.1rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
    }
    
    .empty-icon {
        font-size: 2rem;
    }
    
    /* Footer Mobile Compact Layout */
    .app-footer {
        padding: 20px 0;
        margin-top: 32px;
    }
    
    .footer-content {
        padding: 0 16px;
    }
    
    .footer-left {
        font-size: 0.9rem;
        gap: 6px;
    }
    
    .kofi-link {
        font-size: 0.9rem;
    }
    
    /* Very Small Screens - Ultra compact card actions */
    @media (max-width: 360px) {
        .card-actions .nintendo-button {
            font-size: 0.75rem;
            padding: 6px 8px;
        }
        
        .card-actions .button-text {
            display: none;
        }
        
        .card-actions .nintendo-button::after {
            content: attr(data-short);
            font-weight: 600;
        }
    }
}

/* ====================================
   DESKTOP - 769px TO 1199px
   ==================================== */
@media (min-width: 769px) and (max-width: 1199px) {
    /* Ensure proper side-by-side layout on desktop */
    .nintendo-grid {
        gap: 18px;
        justify-content: center;
    }
    
    .nintendo-card.half-width {
        flex: 0 1 calc(50% - 9px);
        min-width: 280px;
    }
}

/* ====================================
   ULTRA-WIDE DESKTOP - 1200px+
   ==================================== */
@media (min-width: 1200px) {
    /* Enhanced spacing for ultra-wide screens */
    .main-content {
        padding: 10px 40px 30px;
    }
    
    .nintendo-grid {
        gap: 24px;
        justify-content: center;
    }
    
    /* Ensure cards stay side-by-side on ultra-wide screens */
    .nintendo-card.half-width {
        flex: 0 1 calc(50% - 12px);
        min-width: 320px;
    }
    
    .section-title {
        font-size: 36px;
    }
    
    /* Desktop Menu Adjustments */
    .menu-content {
        width: 380px;
    }

    .menu-navigation {
        padding: 28px 24px;
    }

    .menu-nav-item {
        padding: 14px 20px;
        font-size: 15px;
        border-radius: 10px;
    }

    .menu-quick-actions {
        padding: 24px;
    }

    /* Show scroll button on large desktop screens */
    .scroll-to-top,
    #scrollToTop {
        display: flex !important;
    }
}

/* ====================================
   LANDSCAPE MOBILE - 576px TO 768px
   ==================================== */
@media (min-width: 576px) and (max-width: 768px) and (orientation: landscape) {
    /* Optimize for landscape mobile/tablet */
    .header-content {
        flex-direction: row;
        justify-content: space-between;
    }
    
    :root {
        --header-height: 66px; /* Restore desktop height for landscape */
    }
    
    .main-content {
        min-height: calc(100vh - var(--header-height) - var(--nav-height) - var(--footer-height));
    }
}

/* ====================================
   PRINT STYLES
   ==================================== */
@media print {
    /* Hide navigation and interactive elements */
    .nintendo-nav,
    .app-footer,
    .nintendo-button,
    .modal {
        display: none !important;
    }
    
    /* Optimize for print */
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    .nintendo-card {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .section-title {
        color: #000;
        font-size: 18pt;
    }
}

/* ====================================
   HIGH DPI / RETINA DISPLAYS
   ==================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Enhance for high-density displays */
    .pogo-logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* Slightly reduce shadows on high DPI to prevent pixelation */
    .nintendo-card {
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    }
}

/* ====================================
   ACCESSIBILITY - REDUCED MOTION
   ==================================== */
@media (prefers-reduced-motion: reduce) {
    /* Disable animations for users who prefer reduced motion */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    /* Exception: Keep logo XP pulse animation even with reduced motion preference */
    .logo-xplanner::before {
        animation: xpPulse 2s ease-in-out infinite !important;
        animation-duration: 2s !important;
        animation-iteration-count: infinite !important;
    }
    
    .heart-icon {
        animation: none;
    }
    
    .kofi-icon {
        animation: none;
    }
    
    .loading-icon {
        animation: none;
    }
}

/* ====================================
   DARK MODE SUPPORT (Future Enhancement)
   ==================================== */
@media (prefers-color-scheme: dark) {
    /* 
    TODO: Implement dark mode styles
    This section can be expanded in the future to support dark mode
    */
    
    /* Example dark mode overrides:
    :root {
        --nintendo-dark: #ffffff;
        --nintendo-light-gray: #2d3748;
        --nintendo-white: #1a202c;
    }
    */
}

/* ====================================
   TABLET RESPONSIVE - 1024px
   ==================================== */
@media (max-width: 1024px) {
    /* Progress Overview Tablet */
    .overview-stats-grid-with-page {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

/* ====================================
   DASHBOARD SECTIONS MOBILE RESPONSIVE
   ==================================== */
@media (max-width: 768px) {
    /* Dashboard sections mobile layout */
    .dashboard-sections-row {
        gap: 12px;
        margin-top: 12px;
    }
    
    /* Celebration section mobile */
    .celebration-card .card-header {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    /* Progress Overview Mobile */
    .overview-stats-grid-with-page {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .current-page-box {
        order: -1; /* Move current page to top */
        margin-bottom: 16px;
        padding: 16px;
        background: rgba(230, 0, 18, 0.08);
        border: 2px solid rgba(230, 0, 18, 0.15);
    }
    
    .current-page-box .page-selector {
        font-size: 1.2rem;
        justify-content: center;
    }
    
    .current-page-box .page-selector input {
        width: 50px;
        font-size: 1.1rem;
        text-align: center;
    }
    
    .stat-box {
        padding: 12px 16px;
        text-align: center;
    }
    
    .stat-number {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Remaining Summary Mobile */
    .remaining-stats-simple {
        flex-direction: column;
        gap: 16px;
        padding: 12px;
    }
    
    .simple-stat {
        text-align: center;
        padding: 8px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 6px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .simple-stat-number {
        font-size: 1.3rem;
        font-weight: 700;
        order: 1;
    }
    
    .simple-stat-label {
        font-size: 0.8rem;
        order: 2;
    }
    
   
    
    .celebration-task-item {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 10px 0;
    }
    
    .celebration-task-item .task-name {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .celebration-xp-summary {
        flex-direction: column;
        gap: 8px;
        text-align: flex-start;
                align-items: inherit;
    }
    
    /* Level up section mobile */
    .levelup-card .card-header {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    
    
    .levelup-task-item {
        font-size: 0.85rem;
        line-height: 1.4;
        padding: 8px 0;
    }
    
    /* Events section mobile */
    .dashboard-events-section {
        gap: 10px;
    }
    
    .events-list {
        justify-content: center;
        gap: 4px;
    }
    
    .event-tag {
        font-size: 0.75rem;
        padding: 3px 6px;
    }
    
    .friends-summary {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .friend-count-item {
        padding: 6px 4px;
    }
    
    .friend-count {
        font-size: 1rem;
    }
    
    .friend-type {
        font-size: 0.75rem;
    }
    
    .no-friends {
        font-size: 0.8rem;
        padding: 8px;
    }
    
    .quick-link {
        display: block;
        margin-top: 4px;
        margin-left: 0;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .dashboard-sections-row {
        gap: 10px;
        margin-top: 8px;
    }
    
    .celebration-task-item .task-name {
        font-size: 0.8rem;
    }
    
    .levelup-task-item {
        font-size: 0.8rem;
    }
    
    .friends-summary {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .friend-count {
        font-size: 0.9rem;
    }
    
    .event-tag {
        font-size: 0.7rem;
        padding: 2px 5px;
    }

    /* ======================================
       DISABLE HOVER/FOCUS EFFECTS ON MOBILE
       ====================================== */
    /* Remove all transform translateY effects on hover/focus to prevent mobile zoom issues */
    
    .text-logo:hover {
        transform: none !important;
    }
    
    .text-logo:hover .logo-poke {
        transform: none !important;
    }
    
    .text-logo:hover .logo-xplanner {
        transform: none !important;
    }
    
    .text-logo:hover .logo-xplanner::before {
        transform: none !important;
    }
    
    #playerDisplay.player-badge-pill-lv1:hover {
        transform: none !important;
    }
    
    .nav-pill:hover {
        transform: none !important;
    }
    
    .nintendo-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .nintendo-input:focus, 
    .nintendo-select:focus {
        transform: none !important;
    }
    
    .nintendo-button:hover {
        transform: none !important;
    }
    
    .stat-row:hover {
        transform: none !important;
    }
    
    .icon-button:hover,
    .icon-button.close-btn:hover,
    .icon-button.danger:hover {
        transform: none !important;
    }
    
    .snapshot-inline-btn:hover, 
    .download-inline-btn:hover {
        transform: none !important;
    }
    
    .advanced-header:hover {
        transform: none !important;
    }
    
    .scroll-to-top:hover {
        transform: none !important;
    }
    
    /* History page elements */
    .timeline-item:hover, 
    .history-item:hover,
    .metric-card:hover,
    .calculation-item:hover {
        transform: none !important;
    }
    
    /* Calculator page elements */
    .tasks-card__accordion-header:hover,
    .task-level-row:hover,
    .task-row-header:hover,
    .task-row-header.first-level:hover,
    .task-item:hover,
    .reward-item:hover,
    .level-completion-item:hover {
        transform: none !important;
    }
    
    /* Celebration page elements */
    .stat-box:hover,
    .task-card:hover {
        transform: none !important;
    }
    
    /* XP Guide page elements */
    .pro-tips-accordion .accordion-header:hover,
    .xp-table tbody tr:hover,
    .xp-table tbody tr:nth-child(even):hover,
    .recommended-row:hover,
    .recommended-row:nth-child(even):hover,
    .tip-item:hover {
        transform: none !important;
    }
    
    /* Planner page elements */
    .add-activity-btn:hover,
    .event-item:hover,
    .event-tag:hover,
    .template-card:hover,
    .template-select-btn:hover,
    .activity-item:hover {
        transform: none !important;
    }
    
    /* Forecast page elements */
    .forecast-card:hover {
        transform: none !important;
    }
    
    /* ======================================
       DASHBOARD MOBILE LAYOUT FIXES
       ====================================== */
    /* Fix dashboard grid overflow on mobile */
    .dashboard-grid {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        margin: 0;
        padding: 0;
        gap: 12px;
    }
    
    .dashboard-profile-section,
    .dashboard-countdown-section {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    /* Profile section mobile fixes */
    .profile-main-row {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        align-items: center;
    }
    
    .profile-info {
        width: 100%;
        text-align: center;
    }
    
    .trainer-name {
        font-size: 1.5rem;
        word-break: break-word;
        max-width: 100%;
    }
    
    .trainer-level {
        font-size: 1.2rem;
    }
    
    .trainer-xp {
        font-size: 1rem;
        word-break: break-word;
    }
    
    /* Center align XP row in mobile */
    .trainer-xp-row {
        justify-content: center;
    }
    
    /* Progress rings mobile optimization */
    .progress-rings {
        flex-direction: row;
        justify-content: center;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .progress-ring-container {
        width: 80px;
        height: 100px;
        flex-shrink: 1;
        min-width: 70px;
    }
    
    .progress-ring {
        width: 80px;
        height: 80px;
    }
    
    .progress-percent {
        font-size: 0.9rem;
    }
    
    /* Profile stats mobile layout */
    .profile-stats-row {
        grid-template-columns: 1fr;
        gap: 12px;
        text-align: center;
    }
    
    .stat-item {
        padding: 8px;
    }
    
    .stat-value {
        font-size: 1.2rem;
        word-break: break-word;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Countdown section mobile fixes */
    .countdown-card {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .countdown-display {
        font-size: 1.5rem;
        word-break: break-word;
        text-align: center;
    }
    
    .countdown-target {
        font-size: 0.9rem;
        word-break: break-word;
        text-align: center;
    }
    
    .legacy-level-note {
        font-size: 0.75rem;
        display: block;
        text-align: center;
        margin-top: 8px;
    }
}

/* ====================================
   EXTRA SMALL MOBILE - 480px
   ==================================== */
@media (max-width: 480px) {
    /* Very small screen dashboard fixes */
    .progress-rings {
        gap: 8px;
    }
    
    .progress-ring-container {
        width: 70px;
        height: 90px;
        min-width: 60px;
    }
    
    .progress-ring {
        width: 70px;
        height: 70px;
    }
    
    .progress-percent {
        font-size: 0.8rem;
    }
    
    .progress-ring-label {
        font-size: 0.7rem;
    }
    
    .trainer-name {
        font-size: 1.3rem;
    }
    
    .trainer-level {
        font-size: 1.1rem;
    }
    
    .countdown-display {
        font-size: 1.3rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .nintendo-card {
        padding: 12px;
    }
    
    /* Dashboard Level 50 overlay mobile adjustments */
    .speculation-text {
        font-size: 1.1rem;
    }
    
    .wait-text {
        font-size: 0.8rem;
    }
    
    .overlay-content {
        padding: 16px;
    }
    
    /* ====================================
       RESEARCH PAGES MOBILE RESPONSIVE
       ==================================== */
    
    /* Research Pages Container */
    .research-pages {
        padding: 0 16px 20px;
    }
    
    .active-pages-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .completed-pages-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .research-page.next-page {
        grid-column: 1;
    }
    
    /* Research Pages Header Mobile */
    .research-pages-header .card-title-group {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
    }
    
    .research-pages-header .card-title-group h3 {
        margin: 0;
        font-size: 1.2rem;
        order: 1;
    }
    
    .research-pages-header .page-actions {
        order: 2;
        margin-left: 0;
        justify-content: center;
        width: auto;
        flex-direction: row;
        gap: 12px;
        align-items: center;
        padding: 0;
    }
    
    .research-pages-header .lucky-egg-toggle {
        justify-content: center;
        align-items: center;
        gap: 6px;
    }
    
    .research-pages-header .nintendo-button {
        display: none;
    }
    
    /* Research Page Content Mobile */
    .page-header {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        padding: 12px 16px;
    }
    
    .page-info {
        justify-content: flex-start;
        gap: 8px;
        align-items: center;
        width: 100%;
    }
    
    .page-title {
        font-size: 0.9rem;
        line-height: 1.2;
        text-align: center;
        flex: 1;
    }
    
    .page-xp {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 12px;
        width: 100%;
        font-size: 0.8rem;
    }
    
    .task-xp, .completion-xp {
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    /* Task Summary Cards Mobile */
    .task-summary-cards {
       grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 8px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }    .task-card {
        padding: 6px;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    
    .task-card-count {
        font-size: 1.0rem;
        line-height: 1.1;
    }
    
    .task-card-title {
        font-size: 0.6rem;
        line-height: 1.1;
    }
    .tab-content{
        margin-top: 10px;;
    }
}

/* Extra Small Mobile Screens - Under 418px */
@media (max-width: 418px) {
    /* Reduce header height to save space */
    :root {
        --header-height: 70px; /* Reduced from 90px */
    }
    
    /* Header Content - Side by side layout for user details and hamburger */
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        padding: 4px 0;
        min-height: var(--header-height);
    }
    
    /* Logo section takes minimal space */
    .logo-section {
        flex-shrink: 0;
        gap: 4px;
    }
    
    /* Header actions (user details) and hamburger menu side by side */
    .header-actions {
        gap: 6px;
        flex-wrap: nowrap;
        justify-content: flex-end;
        flex-shrink: 0;
    }
    
    /* Hamburger menu positioning */
    .hamburger-menu {
        order: 2;
        flex-shrink: 0;
    }
    
    /* User details positioning */
    .user-details {
        order: 1;
        flex-shrink: 0;
    }
     .pill-badge-lv1{
        margin-right: 5px;
    }
    .logo-poke {
        font-size: 12px;
        padding: 2px 5px 2px 5px;
    }

        .logo-xplanner {
        font-size: 13px;
        padding: 2px 7px 6px 28px;}

        .logo-xplanner::before {
            font-size: 18px;
        }
}
