﻿/* App Responsive Enhancements - Lumnix */

/* Melhorias gerais de responsividade */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Otimizações para touch devices */
@media (hover: none) and (pointer: coarse) {
  .mode-card,
  .tile,
  .cta-button,
  .iwant-button {
    -webkit-tap-highlight-color: rgba(46, 204, 113, 0.3);
    tap-highlight-color: rgba(46, 204, 113, 0.3);
  }
  
  .mode-card:hover,
  .tile:hover {
    transform: none;
  }
  
  .mode-card:active,
  .tile:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}

/* Melhorias para telas pequenas */
@media (max-width: 600px) {
  /* Otimização de espaçamento */
  .invix-section {
    padding: 0 5px 5px 5px;
  }
  
  /* Melhor uso do espaço vertical */
  .categories-section {
    margin-bottom: 15px;
  }
  
  /* Otimização de texto */
  .mode-card p {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  
  /* Melhor visibilidade dos botões */
  .cta-button {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
  }
  
  /* Mood buttons mobile */
  
  
}

/* Mobile: keep AppSensorial top compact */
@media (max-width: 600px) {
  body.appsensorial-page .hero-user-section {
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 26px !important;
  }

  body.appsensorial-page .hero-avatar-frame,
  body.appsensorial-page .hero-avatar,
  body.appsensorial-page .hero-avatar-video,
  body.appsensorial-page .hero-avatar-image {
    width: 72px !important;
    height: 72px !important;
  }

  body.appsensorial-page .hero-mascot-frame,
  body.appsensorial-page .hero-mascot,
  body.appsensorial-page .hero-mascot-video,
  body.appsensorial-page .hero-mascot-image {
    width: 54px !important;
    height: 54px !important;
    margin-left: 0 !important;
  }
}

/* Otimizações para orientação portrait */
@media (max-width: 768px) and (orientation: portrait) {
  .dashboard-grid,
  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
  }
  
  .mode-card {
    min-height: 120px;
    height: 120px;
    padding: 10px;
  }
  
  .mode-card .emoji-icon {
    font-size: 2rem;
  }
  
  .mode-card p {
    font-size: 0.8rem;
    line-height: 1.1;
  }
}

/* Otimizações para orientação landscape em mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .welcome-banner {
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    padding: 14px;
  }
  
  .skills-xp-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }
  
  
  .mode-card {
    min-height: 100px;
    height: 100px;
    padding: 8px;
  }
  
  .mode-card .emoji-icon {
    font-size: 1.6rem;
  }
  
  .mode-card p {
    font-size: 0.7rem;
  }
}

/* Tablets = comportamento de mobile (consistência visual) */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Tablet layout: compacto e elegante */
  body.appsensorial-page .invix-main {
    padding: 14px !important;
  }

  body.appsensorial-page .invix-section {
    padding: 10px !important;
  }

  body.appsensorial-page .welcome-banner {
    border-radius: 18px !important;
  }
  .dashboard-grid,
  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
  }
  
  
  .mode-card {
    min-height: 120px;
    height: 120px;
    padding: 10px;
  }
  
  .mode-card .emoji-icon {
    font-size: 2rem;
  }
  
  .mode-card p {
    font-size: 0.8rem;
    line-height: 1.1;
  }
  
  .welcome-banner {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 18px !important;
  }
  
  .hero-left,
  .hero-right {
    width: 100% !important;
  }
  
  .Lumnix-categories-section .Lumnix-tiles-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  .Lumnix-categories-section .Lumnix-tile {
    width: 100% !important;
    min-width: auto !important;
    height: 140px !important;
  }
  
  .skills-xp-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  /* Avatar + mascote grandes e lado a lado no tablet */
  .hero-user-section {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 16px !important;
  }

  .hero-avatar-frame {
    width: 140px !important;
    height: 140px !important;
  }

  .hero-avatar,
  .hero-avatar-video,
  .hero-avatar-image {
    width: 140px !important;
    height: 140px !important;
  }

  .hero-mascot-frame {
    width: 110px !important;
    height: 110px !important;
    margin-left: 0 !important;
  }

  .hero-mascot,
  .hero-mascot-video,
  .hero-mascot-image {
    width: 110px !important;
    height: 110px !important;
  }

  /* Home: cards de experiências (2x2, elegantes e proporcionais) */
  body.appsensorial-page .Lumnix-categories-section .Lumnix-tiles-grid {
    justify-content: center !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 14px !important;
    row-gap: 14px !important;
    max-width: 96% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tiles-grid > .Lumnix-tile {
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: 0 !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    border-radius: 16px !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-content {
    padding: 16px !important;
    gap: 10px !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-text h3 {
    font-size: 1.35rem !important;
    line-height: 1.15 !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-text p {
    font-size: 0.98rem !important;
    line-height: 1.25 !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile .emoji-icon {
    font-size: 4.2rem !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-icon svg {
    width: 76px !important;
    height: 76px !important;
  }

  /* Home: skills XP (centralizadas, legíveis e elegantes) */
  body.appsensorial-page .skills-xp {
    text-align: center !important;
  }

  body.appsensorial-page .skills-xp h3 {
    text-align: center !important;
    font-size: 1.2rem !important;
    margin-bottom: 12px !important;
  }

  body.appsensorial-page .skills-xp-grid {
    grid-template-columns: repeat(6, minmax(0, 90px)) !important;
    gap: 40px !important;
    justify-content: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 0 8px !important;
  }

  body.appsensorial-page .skill-xp-item {
    width: 90px !important;
    height: 130px !important;
    padding: 6px !important;
  }

  body.appsensorial-page .skill-hex-shape,
  body.appsensorial-page .skill-hex-fill {
    width: 74px !important;
    height: 88px !important;
  }

  body.appsensorial-page .skill-icon-center {
    font-size: 2.3rem !important;
  }

  body.appsensorial-page .skill-xp-name {
    font-size: 0.85rem !important;
  }

  body.appsensorial-page .skill-xp-value {
    font-size: 0.8rem !important;
  }
}

/* iPad Air/Pro refinement (touch tablets) */
@media (min-width: 820px) and (max-width: 1366px) and (hover: none) and (pointer: coarse) {
  /* Escolha sua experiência */
  body.appsensorial-page .Lumnix-categories-section .Lumnix-tiles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 14px !important;
    row-gap: 14px !important;
    max-width: 92% !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tiles-grid > .Lumnix-tile {
    aspect-ratio: 1 / 1 !important;
    border-radius: 16px !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-content {
    padding: 14px !important;
    gap: 10px !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile .emoji-icon {
    font-size: 3.6rem !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-icon svg {
    width: 72px !important;
    height: 72px !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-text h3 {
    font-size: 1.25rem !important;
    line-height: 1.2 !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tile-text p {
    font-size: 0.95rem !important;
    line-height: 1.25 !important;
  }

  /* Skills XP */
  body.appsensorial-page .skills-xp {
    text-align: center !important;
  }

  body.appsensorial-page .skills-xp h3 {
    text-align: center !important;
    font-size: 1.2rem !important;
    margin-bottom: 12px !important;
  }

  body.appsensorial-page .skills-xp-grid {
    grid-template-columns: repeat(3, minmax(0, 120px)) !important;
    gap: 18px !important;
    justify-content: center !important;
    overflow-x: hidden !important;
  }

  body.appsensorial-page .skill-xp-item {
    width: 120px !important;
    height: 150px !important;
    padding: 6px !important;
  }

  body.appsensorial-page .skill-hex-shape,
  body.appsensorial-page .skill-hex-fill {
    width: 96px !important;
    height: 108px !important;
  }

  body.appsensorial-page .skill-icon-center {
    font-size: 2.1rem !important;
  }

  body.appsensorial-page .skill-xp-name {
    font-size: 0.8rem !important;
  }

  body.appsensorial-page .skill-xp-value {
    font-size: 0.75rem !important;
  }
}

/* Melhorias para telas grandes */
@media (min-width: 1200px) {
  .dashboard-grid,
  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
  }
  
  
  .mode-card {
    min-height: 150px;
    height: 150px;
    padding: 15px;
  }
  
  .mode-card .emoji-icon {
    font-size: 2.8rem;
  }
  
  .mode-card p {
    font-size: 0.95rem;
  }
}

/* Otimizações para performance em mobile */
@media (max-width: 768px) {
  /* Reduz animações em dispositivos móveis */
  .mode-card,
  .tile,
  .iwant-button {
    transition: transform 0.2s ease;
  }
  
  /* Otimiza backdrop-filter para mobile */
  .invix-sidebar,
  .tile,
  .welcome-banner,
  .settings-card {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  
  /* Banner de boas-vindas */
  .welcome-banner {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 18px !important;
  }
  
  .hero-left,
  .hero-right {
    width: 100% !important;
  }
  
  /* Cards de experiência */
  .Lumnix-categories-section .Lumnix-tiles-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  .Lumnix-categories-section .Lumnix-tile {
    width: 100% !important;
    min-width: auto !important;
    height: 140px !important;
  }
  
  /* Skills XP */
  .skills-xp-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  
  /* Configurações */
  .settings-row {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
  }
  
  .settings-card {
    padding: 15px !important;
  }
  
  .settings-card h3 {
    font-size: 1rem !important;
  }
  
  .settings-card input,
  .settings-card select {
    font-size: 0.9rem !important;
    padding: 10px !important;
  }
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .mode-card:hover,
  .tile:hover {
    transform: none !important;
  }
}

/* Alto contraste */
@media (prefers-contrast: high) {
  .mode-card,
  .tile,
  .cta-button {
    border: 2px solid var(--accent-color);
  }
  
  .mode-card p,
  .tile p {
    color: #FFFFFF;
    font-weight: 500;
  }
}

/* Modo escuro do sistema */
@media (prefers-color-scheme: dark) {
  /* Já está otimizado para escuro por padrão */
}

/* Otimizações específicas para iOS */
@supports (-webkit-touch-callout: none) {
  .invix-sidebar,
  .invix-main {
    -webkit-overflow-scrolling: touch;
  }
  
  .mode-card,
  .tile,
  .cta-button {
    -webkit-tap-highlight-color: rgba(46, 204, 113, 0.3);
  }
}

/* Otimizações para Android */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
  .mode-card .emoji-icon,
  .tile .emoji-icon {
    text-rendering: optimizeLegibility;
  }
}

/* Melhorias para telas de alta densidade */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .mode-card,
  .tile {
    border-radius: 8px;
  }
  
  .cta-button {
    border-radius: 6px;
  }
}

/* Otimizações para PWA */
@media (display-mode: standalone) {
  .invix-main {
    padding-top: 0;
    padding-bottom: env(safe-area-inset-bottom, 15px);
  }
  
  #back-button {
    top: calc(env(safe-area-inset-top, 15px) + 10px);
  }
}

/* Melhorias para notch/safe areas */
@supports (padding: max(0px)) {
  .invix-main {
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
  }
  
  .invix-sidebar {
    padding-left: max(15px, env(safe-area-inset-left));
  }
}

@media (max-width: 768px) {
  /* Cards de resumo em 2 colunas */
  #reports .Lumnix-tiles-grid {
    gap: 10px !important;
  }
  
  #reports .Lumnix-tile {
    min-width: calc(50% - 5px) !important;
    max-width: calc(50% - 5px) !important;
    flex: 0 0 calc(50% - 5px) !important;
    min-height: 110px !important;
    height: auto !important;
  }
  
  #reports .Lumnix-tile h3 {
    font-size: 0.85rem !important;
  }
  
  #reports .Lumnix-tile p {
    font-size: 1.1rem !important;
  }
  
  /* Gráficos responsivos */
  #reports .Lumnix-tile:not(.Lumnix-tiles-grid > .Lumnix-tile) {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  #skills-radar-chart,
  #session-timeline-chart,
  #time-spent-chart {
    min-height: 300px !important;
    height: 300px !important;
    max-width: 100% !important;
  }
  
  #reports .Lumnix-tile-content {
    padding: 15px !important;
  }
  
  #reports .Lumnix-tile-content > div[style*="position: relative"] {
    height: 320px !important;
    padding: 10px 0 !important;
  }
  
  /* Insights */
  #timeline-insight,
  #skills-insight,
  #distribution-insight {
    padding: 12px !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    margin-top: 10px !important;
  }
  
  /* Alertas */
  #alerts-container > div {
    padding: 12px !important;
    font-size: 0.85rem !important;
  }
  
  #insights-card .Lumnix-tile-content {
    padding: 15px !important;
  }
  
  /* Skills XP */
  .skills-xp-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
}

@media (max-width: 480px) {
  #reports .Lumnix-tiles-grid {
    gap: 8px !important;
  }
  
  #reports .Lumnix-tile {
    min-height: 100px !important;
    padding: 8px !important;
  }
  
  #reports .Lumnix-tile h3 {
    font-size: 0.75rem !important;
  }
  
  #reports .Lumnix-tile p {
    font-size: 1rem !important;
  }
  
  #skills-radar-chart,
  #session-timeline-chart,
  #time-spent-chart {
    min-height: 250px !important;
    height: 250px !important;
  }
  
  #reports .Lumnix-tile-content > div[style*="position: relative"] {
    height: 270px !important;
  }
  
  #timeline-insight,
  #skills-insight,
  #distribution-insight {
    padding: 10px !important;
    font-size: 0.8rem !important;
  }
}



/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  #reports .Lumnix-tiles-grid {
    gap: 10px !important;
  }
  
  #reports .Lumnix-tile {
    min-width: calc(33.333% - 7px) !important;
    max-width: calc(33.333% - 7px) !important;
    flex: 0 0 calc(33.333% - 7px) !important;
  }
  
  #skills-radar-chart,
  #session-timeline-chart,
  #time-spent-chart {
    min-height: 250px !important;
    height: 250px !important;
  }
  
  #reports .Lumnix-tile-content > div[style*="position: relative"] {
    height: 270px !important;
  }
}

/* AppSensorial: compact mobile layout (page-specific overrides) */
@media (max-width: 600px) {
  body.appsensorial-page .invix-main {
    padding: 6px 8px 8px 8px !important;
  }

  body.appsensorial-page .invix-section {
    padding: 0 6px 6px 6px !important;
  }

  /* Ritmo vertical entre blocos principais */
  body.appsensorial-page #kids > * + * {
    margin-top: 12px !important;
  }

  body.appsensorial-page #kids .welcome-banner > * + * {
    margin-top: 8px !important;
  }

  body.appsensorial-page .welcome-banner {
    padding: 14px !important;
    gap: 12px !important;
    border-radius: 18px !important;
    margin-bottom: 8px !important;
  }

  body.appsensorial-page .hero-user-section {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 26px !important;
  }

  /* Keep the top compact on mobile so "Escolha sua experiência / Choose your experience" + cards appear immediately */
  body.appsensorial-page .hero-avatar,
  body.appsensorial-page .hero-avatar-video,
  body.appsensorial-page .hero-avatar-image,
  body.appsensorial-page .hero-avatar-frame {
    width: 72px !important;
    height: 72px !important;
    flex-shrink: 0 !important;
  }

  body.appsensorial-page .hero-mascot,
  body.appsensorial-page .hero-mascot-video,
  body.appsensorial-page .hero-mascot-image,
  body.appsensorial-page .hero-mascot-frame {
    width: 54px !important;
    height: 54px !important;
    margin-left: 0 !important;
    flex-shrink: 0 !important;
  }

  body.appsensorial-page .hero-user-info h2,
  body.appsensorial-page .hero-user-info h2 span {
    font-size: 1.05rem !important;
    line-height: 1.2 !important;
  }

  body.appsensorial-page .hero-stats {
    gap: 10px !important;
    flex-wrap: wrap !important;
  }

  /* Prioriza "Escolha sua experiencia" na primeira dobra */
  body.appsensorial-page .hero-stats {
    display: none !important;
  }

  body.appsensorial-page .hero-recommended h3 {
    display: none !important;
  }

  body.appsensorial-page .hero-stat-value {
    font-size: 1.1rem !important;
  }

  body.appsensorial-page .hero-stat-label {
    font-size: 0.62rem !important;
  }

  body.appsensorial-page .hero-game-card {
    padding: 12px !important;
    border-radius: 10px !important;
  }

  body.appsensorial-page .hero-game-title {
    font-size: 1.05rem !important;
    margin-bottom: 6px !important;
  }

  body.appsensorial-page .hero-game-reason {
    font-size: 0.76rem !important;
    margin-bottom: 10px !important;
  }

  body.appsensorial-page .hero-game-reason {
    display: none !important;
  }

  body.appsensorial-page .hero-play-button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
    padding: 10px 12px !important;
    font-size: 0.9rem !important;
  }

  body.appsensorial-page .skills-xp {
    margin-top: 8px !important;
    padding: 8px !important;
    border-radius: 10px !important;
    margin-bottom: 14px !important;
  }

  body.appsensorial-page .skills-xp h3 {
    display: none !important;
  }

  body.appsensorial-page .skills-xp-grid {
    max-width: 100% !important;
    padding: 0 !important;
    gap: 8px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.appsensorial-page .skill-xp-item {
    min-height: 0 !important;
    padding: 8px !important;
    border-radius: 6px !important;
    gap: 6px !important;
  }

  body.appsensorial-page .skill-circular-progress {
    width: 34px !important;
    height: 34px !important;
  }

  body.appsensorial-page .Lumnix-categories-section {
    margin: 8px 0 8px !important;
  }

  body.appsensorial-page .Lumnix-categories-section > h2 {
    margin-bottom: 8px !important;
  }

  body.appsensorial-page .Lumnix-categories-section > .Lumnix-tiles-grid {
    margin-top: 4px !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tiles-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 10px !important;
    row-gap: 12px !important;
    width: 100% !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tiles-grid > .Lumnix-tile {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 110px !important;
    flex-shrink: 1 !important;
  }

  body.appsensorial-page .Lumnix-tile {
    border-radius: 10px !important;
    min-height: 118px !important;
  }

  body.appsensorial-page .Lumnix-tile-content {
    padding: 12px !important;
    gap: 7px !important;
  }

  body.appsensorial-page .Lumnix-tile-text h3 {
    font-size: 0.92rem !important;
    line-height: 1.2 !important;
  }

  body.appsensorial-page .Lumnix-tile-text p {
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
  }

  body.appsensorial-page #reports .Lumnix-tiles-grid {
    gap: 8px !important;
  }

  body.appsensorial-page #reports .Lumnix-tiles-grid > .Lumnix-tile {
    min-width: 0 !important;
    max-width: none !important;
    flex: 1 1 calc(50% - 4px) !important;
    height: 105px !important;
    min-height: 105px !important;
  }

  body.appsensorial-page .settings-card {
    padding: 12px !important;
  }

  body.appsensorial-page .settings-option label {
    font-size: 0.82rem !important;
  }
}

@media (max-width: 480px) {
  body.appsensorial-page .invix-main {
    padding: 8px 6px !important;
  }

  body.appsensorial-page .welcome-banner {
    padding: 10px !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  body.appsensorial-page .Lumnix-categories-section .Lumnix-tiles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 8px !important;
    row-gap: 10px !important;
  }

  body.appsensorial-page .Lumnix-tile {
    aspect-ratio: auto !important;
    min-height: 110px !important;
  }

  body.appsensorial-page .Lumnix-tile-icon svg {
    width: 30px !important;
    height: 30px !important;
  }

  body.appsensorial-page .Lumnix-tile-content {
    padding: 10px !important;
    gap: 6px !important;
  }

  body.appsensorial-page .Lumnix-tile-text h3 {
    font-size: 0.84rem !important;
  }

  body.appsensorial-page .Lumnix-tile-text p {
    font-size: 0.68rem !important;
  }

  body.appsensorial-page .skills-xp-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body.appsensorial-page .skills-xp {
    margin-bottom: 12px !important;
  }

  body.appsensorial-page #reports .Lumnix-tiles-grid > .Lumnix-tile {
    flex: 1 1 calc(50% - 4px) !important;
    height: 96px !important;
    min-height: 96px !important;
  }

  body.appsensorial-page #reports .Lumnix-tile h3 {
    font-size: 0.72rem !important;
    margin-bottom: 5px !important;
  }

  body.appsensorial-page #reports .Lumnix-tile p {
    font-size: 1rem !important;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  body.appsensorial-page .welcome-banner {
    grid-template-columns: 1fr 1fr !important;
  }

  body.appsensorial-page .Lumnix-tiles-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* ========== MOBILE PERFORMANCE: reduced-fx rules ========== */

/* Disable body::before 200% animated gradient on mobile */
@media (max-width: 768px) {
  body::before {
    animation: none !important;
    display: none !important;
  }
}

body.reduced-fx::before {
  animation: none !important;
  display: none !important;
}

/* Report cards use inline desktop widths. Keep summaries in two readable columns on phones. */
@media (max-width: 768px) {
  #reports #reports-content > .Lumnix-tiles-grid,
  #reports #reports-content > .Lumnix-tile .Lumnix-tiles-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch;
    gap: clamp(8px, 2.5vw, 12px) !important;
    width: 100% !important;
  }

  #reports #reports-content > .Lumnix-tiles-grid > .Lumnix-tile,
  #reports #reports-content > .Lumnix-tile .Lumnix-tiles-grid > .Lumnix-tile {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 112px !important;
    height: auto !important;
    flex: none !important;
  }

  /* Narrative and chart panels remain full width; only their summary cards form a grid. */
  #reports #reports-content > .Lumnix-tile {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }

  #reports #reports-content .Lumnix-tile-content {
    min-width: 0;
    padding: clamp(10px, 3vw, 15px) !important;
  }

  #reports #reports-content .Lumnix-tile h3,
  #reports #reports-content .Lumnix-tile p,
  #reports #reports-content .Lumnix-tile span {
    overflow-wrap: anywhere;
  }

  #reports #reports-content > .Lumnix-tiles-grid > .Lumnix-tile h3,
  #reports #reports-content > .Lumnix-tile .Lumnix-tiles-grid > .Lumnix-tile h3 {
    font-size: clamp(0.75rem, 3vw, 0.9rem) !important;
    line-height: 1.2 !important;
  }

  #reports #reports-content > .Lumnix-tiles-grid > .Lumnix-tile p,
  #reports #reports-content > .Lumnix-tile .Lumnix-tiles-grid > .Lumnix-tile p {
    font-size: clamp(1rem, 4vw, 1.25rem) !important;
    line-height: 1.2 !important;
  }

  #reports .report-controls,
  #reports .reports-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  #reports .report-controls > *,
  #reports .reports-filters > * {
    min-width: 0;
    flex: 1 1 160px;
  }
}

/* Disable heavy card animations on mobile / reduced-fx */
@media (max-width: 768px) {
  .mode-card,
  .tile,
  .Lumnix-tile {
    animation: none !important;
    opacity: 1 !important;
    transition: transform 0.15s ease !important;
  }

  .welcome-banner {
    animation: none !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease !important;
  }

  .hero-user-section,
  .skills-xp {
    animation: none !important;
    opacity: 1 !important;
  }

  .skill-xp-item {
    animation: none !important;
    opacity: 1 !important;
    transition: transform 0.15s ease !important;
  }

  .Lumnix-categories-section {
    animation: none !important;
    opacity: 1 !important;
  }
}

body.reduced-fx .mode-card,
body.reduced-fx .tile,
body.reduced-fx .Lumnix-tile {
  animation: none !important;
  opacity: 1 !important;
}

body.reduced-fx .welcome-banner,
body.reduced-fx .hero-user-section,
body.reduced-fx .skills-xp {
  animation: none !important;
  opacity: 1 !important;
}

body.reduced-fx .skill-xp-item {
  animation: none !important;
  opacity: 1 !important;
}

body.reduced-fx .Lumnix-categories-section {
  animation: none !important;
  opacity: 1 !important;
}

/* GPU hints for remaining animated elements */
.Lumnix-tile,
.mode-card,
.welcome-banner,
.skills-xp,
.skill-xp-item {
  contain: layout style;
  will-change: transform;
}




