/* AI Project Universe V6.26 — design-preserving mobile refinement.
   Keeps the V6.26 visual identity and footer. Only mobile sizing, scrolling,
   control placement, cookie-sheet safety and contrast are corrected. */

:root{
  --apu-v626mf-bar-actual:72px;
  --apu-v626mf-ink:#0a0d14;
  --apu-v626mf-paper:#f8fafc;
}

html[data-apu-v626-mobile-fixed='true']{
  scroll-padding-top:calc(var(--apu-v626mf-bar-actual) + 14px)!important;
}

@media (max-width:760px){
  html,body{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow-x:hidden!important;
    overscroll-behavior-x:none!important;
  }
  html{scroll-behavior:smooth!important}
  body{
    touch-action:pan-y pinch-zoom!important;
    -webkit-overflow-scrolling:touch!important;
    text-size-adjust:100%!important;
    -webkit-text-size-adjust:100%!important;
  }
  body>#root,#root,#root>div,#root main,#root section,#root article{
    min-width:0!important;
    max-width:100%!important;
  }
  #root :where(img,video,canvas,svg,iframe){max-width:100%!important;height:auto}
  #root :where(pre,code,table){max-width:100%!important}
  #root :where(pre,.overflow-auto,.overflow-x-auto,[class*='overflow-x']){
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-inline:contain!important;
  }

  /* Keep the original V6.26 glass toolbar, but make it compact and stable. */
  #apu-v624-utilitybar{
    position:sticky!important;
    top:0!important;
    left:0!important;
    right:0!important;
    z-index:2147482400!important;
    display:flex!important;
    flex-flow:row nowrap!important;
    align-items:center!important;
    justify-content:space-between!important;
    align-content:center!important;
    width:100%!important;
    max-width:100vw!important;
    min-height:calc(66px + env(safe-area-inset-top))!important;
    height:auto!important;
    margin:0!important;
    padding:calc(9px + env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 9px max(10px,env(safe-area-inset-left))!important;
    gap:9px!important;
    overflow:visible!important;
    border-radius:0!important;
    backdrop-filter:blur(18px) saturate(145%)!important;
    -webkit-backdrop-filter:blur(18px) saturate(145%)!important;
  }

  #apu-v624-brand{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    flex:1 1 auto!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    gap:9px!important;
  }
  #apu-v624-brand img{
    width:40px!important;
    height:40px!important;
    flex:0 0 40px!important;
    border-radius:11px!important;
    box-shadow:2px 2px 0 currentColor!important;
  }
  #apu-v624-brand-copy{
    display:grid!important;
    min-width:0!important;
    max-width:100%!important;
    gap:2px!important;
  }
  #apu-v624-brand-copy strong{
    display:block!important;
    max-width:clamp(112px,34vw,220px)!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:12px!important;
    line-height:1.15!important;
  }
  #apu-v624-brand-copy small{
    max-width:clamp(112px,34vw,220px)!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:8px!important;
    line-height:1.1!important;
  }

  #apu-v624-controls-slot{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    flex:0 0 auto!important;
    width:auto!important;
    min-width:0!important;
    max-width:58vw!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62,
  #apu-v624-controls-slot #apu-ui-dock-v62[data-apu-inline='true']{
    position:static!important;
    inset:auto!important;
    display:flex!important;
    flex-flow:row nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:44px!important;
    margin:0!important;
    padding:0!important;
    gap:8px!important;
    overflow:visible!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-brand-v62{display:none!important}
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-theme-v62,
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-wrap-v62{
    flex:0 0 auto!important;
    height:44px!important;
    min-height:44px!important;
    max-height:44px!important;
    border-radius:13px!important;
    box-shadow:0 3px 0 rgba(15,23,42,.24)!important;
    overflow:hidden!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-theme-v62{
    min-width:72px!important;
    max-width:84px!important;
    padding:0 11px!important;
    gap:7px!important;
    white-space:nowrap!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-wrap-v62{
    flex-basis:142px!important;
    width:142px!important;
    min-width:112px!important;
    max-width:142px!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-v62{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:42px!important;
    min-height:42px!important;
    padding:0 26px 0 36px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:12px!important;
    font-weight:850!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-translation-progress-v62{
    right:4px!important;
    bottom:-17px!important;
    max-width:132px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  #apu-ui-toast-v62{
    top:calc(var(--apu-v626mf-bar-actual) + 10px)!important;
    right:max(10px,env(safe-area-inset-right))!important;
    left:max(10px,env(safe-area-inset-left))!important;
    bottom:auto!important;
    width:auto!important;
    max-width:none!important;
  }

  /* Cookie panel remains V6.26, but behaves like a safe mobile bottom sheet. */
  .apu-cookie-panel{
    left:max(10px,env(safe-area-inset-left))!important;
    right:max(10px,env(safe-area-inset-right))!important;
    bottom:max(10px,env(safe-area-inset-bottom))!important;
    width:auto!important;
    max-width:none!important;
    max-height:min(76dvh,620px)!important;
    margin:0!important;
    padding:16px!important;
    gap:14px!important;
    grid-template-columns:minmax(0,1fr)!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    border-radius:19px!important;
  }
  .apu-cookie-panel,.apu-cookie-panel *{
    color:#080808!important;
    -webkit-text-fill-color:#080808!important;
    text-shadow:none!important;
  }
  .apu-cookie-panel__actions{
    width:100%!important;
    min-width:0!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  .apu-cookie-panel button{
    width:100%!important;
    min-width:0!important;
    min-height:50px!important;
    white-space:normal!important;
  }
  .apu-cookie-panel a{
    font-weight:900!important;
    text-decoration-thickness:2px!important;
    text-underline-offset:3px!important;
  }

  /* Preserve the V6.26 project footer while preventing mobile clipping. */
  .apu-project-footer{width:100%!important;max-width:100%!important;overflow:hidden!important}
  .apu-project-footer__inner{
    width:calc(100% - 24px)!important;
    max-width:720px!important;
    grid-template-columns:minmax(0,1fr)!important;
    align-items:start!important;
    gap:26px!important;
    padding-bottom:calc(38px + env(safe-area-inset-bottom))!important;
  }
  .apu-project-footer__brand,
  .apu-project-footer__copy,
  .apu-project-footer__symbols{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }
  .apu-project-footer__logo{
    max-width:100%!important;
    overflow-wrap:anywhere!important;
  }
  .apu-project-footer__symbols{
    grid-column:auto!important;
    justify-self:start!important;
  }
}

@media (max-width:480px){
  #apu-v624-utilitybar{
    min-height:calc(62px + env(safe-area-inset-top))!important;
    padding-top:calc(8px + env(safe-area-inset-top))!important;
    padding-bottom:8px!important;
    gap:7px!important;
  }
  #apu-v624-brand{width:auto!important;justify-content:flex-start!important;gap:7px!important}
  #apu-v624-brand img{width:36px!important;height:36px!important;flex-basis:36px!important;border-radius:10px!important}
  #apu-v624-brand-copy strong{max-width:clamp(82px,28vw,124px)!important;font-size:10px!important}
  #apu-v624-brand-copy small{display:none!important}
  #apu-v624-controls-slot{width:auto!important;max-width:62vw!important;justify-content:flex-end!important}
  #apu-v624-controls-slot #apu-ui-dock-v62,
  #apu-v624-controls-slot #apu-ui-dock-v62[data-apu-inline='true']{
    width:auto!important;
    justify-content:flex-end!important;
    gap:6px!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-theme-v62,
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-wrap-v62{
    height:42px!important;
    min-height:42px!important;
    max-height:42px!important;
    border-radius:12px!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-theme-v62{
    width:44px!important;
    min-width:44px!important;
    max-width:44px!important;
    padding:0!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-theme-v62 span{display:none!important}
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-wrap-v62{
    flex-basis:104px!important;
    width:104px!important;
    min-width:92px!important;
    max-width:112px!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-v62{
    height:40px!important;
    min-height:40px!important;
    padding-left:33px!important;
    padding-right:22px!important;
    font-size:10px!important;
  }
  .apu-cookie-panel__actions{grid-template-columns:minmax(0,1fr)!important}
  .apu-project-footer__links{align-items:flex-start!important;flex-direction:column!important;gap:10px!important}
}

@media (max-width:350px){
  #apu-v624-brand-copy strong{max-width:72px!important}
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-wrap-v62{
    flex-basis:88px!important;width:88px!important;min-width:84px!important;max-width:92px!important;
  }
  #apu-v624-controls-slot #apu-ui-dock-v62 .apu-ui-language-v62{padding-left:29px!important;padding-right:17px!important}
}

@media (orientation:landscape) and (max-height:520px) and (max-width:900px){
  #apu-v624-utilitybar{position:sticky!important;min-height:56px!important;padding-top:6px!important;padding-bottom:6px!important}
  #apu-v624-brand img{width:36px!important;height:36px!important;flex-basis:36px!important}
  .apu-cookie-panel{max-height:calc(100dvh - 16px)!important;padding:12px!important}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto!important}
  #apu-v624-utilitybar *, .apu-cookie-panel *{transition:none!important;animation:none!important}
}

@media print{
  #apu-v624-utilitybar,.apu-cookie-panel,#apu-ui-toast-v62{display:none!important}
}
