/*
 * MY LITTLE JOURNEY · MOBILE LAYOUT (v1.1)
 * Responsive overrides intentionally loaded LAST.
 * Breakpoints: tablet <= 900px; phone <= 600px; small phone <= 390px.
 * Desktop layout remains unchanged.
 */
@media (max-width:900px) {
 html,body{width:100%;max-width:100%;overflow-x:clip!important}
 .world{
   display:flex!important;flex-direction:column!important;align-items:stretch!important;
   width:100%!important;min-width:0!important;max-width:100%!important;
   height:auto!important;min-height:100svh!important;max-height:none!important;
   padding:0 0 24px!important;overflow:clip!important;
   grid-template-columns:none!important;grid-template-rows:none!important;
 }
 .world>.background,.world>.wash{
   position:absolute!important;inset:0!important;width:100%!important;
   height:100%!important;min-height:100%!important;transform:none!important;
   pointer-events:none!important;
 }
 .world>.background{background-position:32% top!important;background-size:auto 690px!important;background-repeat:no-repeat!important;background-color:#e0edf7!important}
 .world>.wash{background:linear-gradient(180deg,#6a9dc422 0%,#c8e4f136 260px,#e5f0f9f0 610px,#e5f0f9 100%)!important}
 .topbar{
   position:relative!important;order:0!important;z-index:70!important;
   width:100%!important;min-width:0!important;height:auto!important;min-height:66px!important;
   display:flex!important;flex-wrap:wrap!important;justify-content:space-between!important;
   align-items:center!important;gap:8px!important;padding:10px 12px!important;
 }
 .topbar .brand{margin:0!important;max-width:100%!important;min-width:0!important;padding:9px 12px!important;letter-spacing:.5px!important}
 .topbar .brand small{display:none!important}
 .topbar .status.new-hud{position:relative!important;inset:auto!important;display:flex!important;flex-wrap:nowrap!important;gap:5px!important;margin:0 0 0 auto!important;min-width:0!important}
 .new-hud .hud-pill{white-space:nowrap!important;font-size:11px!important;padding:8px 10px!important;min-height:37px!important}
 .topbar .status.new-hud #sound{font-size:15px!important;min-width:38px!important;min-height:37px!important;padding:6px 8px!important}
 .social-wrap{position:relative!important}
 .social-menu{position:absolute!important;top:calc(100% + 8px)!important;left:auto!important;right:0!important;z-index:90!important;max-width:min(280px,calc(100vw - 24px))!important}
 .station-board,.welcome-bubble,.ticket,.level,.character-note{display:none!important}
 .sidebar{
   order:1!important;position:sticky!important;top:0!important;left:auto!important;z-index:65!important;
   width:100%!important;max-width:100%!important;min-height:0!important;max-height:none!important;
   padding:7px 10px!important;margin:0!important;overflow:visible!important;
   background:linear-gradient(90deg,#557aa9f0,#87a8c9ed)!important;
   border-block:1px solid #ffffff99!important;box-shadow:0 5px 12px #385d7b33!important;
   backdrop-filter:blur(12px)!important;-webkit-backdrop-filter:blur(12px)!important;
 }
 .sidebar .sidehead,.sidebar .sidefoot{display:none!important}
 .sidebar nav{
   display:flex!important;gap:7px!important;flex-wrap:nowrap!important;
   width:100%!important;max-width:100%!important;min-width:0!important;
   overflow-x:auto!important;overflow-y:hidden!important;
   scrollbar-width:none!important;overscroll-behavior-x:contain!important;
   -webkit-overflow-scrolling:touch!important;scroll-snap-type:x proximity!important;
   padding:2px 1px 5px!important;
 }
 .sidebar nav::-webkit-scrollbar{display:none!important}
 .sidebar nav button,.sidebar nav button.active,.sidebar nav button:hover{
   display:flex!important;align-items:center!important;justify-content:center!important;
   gap:6px!important;flex:0 0 auto!important;width:auto!important;max-width:none!important;
   min-width:max-content!important;min-height:43px!important;height:43px!important;
   padding:6px 12px!important;margin:0!important;
   transform:none!important;scroll-snap-align:start!important;border-radius:12px!important;
 }
 .sidebar nav button>img{width:27px!important;height:27px!important;flex:0 0 27px!important;object-fit:contain!important}
 .sidebar nav button .nav-caption{display:inline!important;overflow:visible!important;white-space:nowrap!important;width:auto!important;font-size:12px!important}
 .character-stage{
   order:2!important;position:relative!important;inset:auto!important;
   z-index:1!important;transform:none!important;align-self:center!important;
   width:min(76vw,330px)!important;max-width:100%!important;height:clamp(145px,40vw,255px)!important;
   min-height:0!important;max-height:none!important;margin:6px auto -4px!important;
   overflow:hidden!important;pointer-events:none!important;
 }
 .character-art{display:block!important;max-height:100%!important;height:100%!important;width:100%!important;object-fit:contain!important;object-position:bottom center!important;transform:none!important}
 .journal{
   order:3!important;position:relative!important;inset:auto!important;z-index:5!important;
   align-self:center!important;transform:none!important;
   width:calc(100% - 28px)!important;max-width:720px!important;
   height:auto!important;min-height:0!important;max-height:none!important;
   display:block!important;margin:8px auto 0!important;scroll-margin-top:76px!important;
 }
 .journal-top{display:none!important;height:0!important;min-height:0!important;flex:0 0 0!important}
 .notebook{
   display:flex!important;flex-direction:column!important;position:relative!important;
   width:100%!important;min-width:0!important;max-width:100%!important;
   height:auto!important;min-height:350px!important;max-height:none!important;
   padding:48px 16px 14px 24px!important;
   border:6px solid #7899b9!important;border-radius:18px!important;
   overflow:visible!important;
 }
 .notebook:after{right:-11px!important;width:8px!important}
 .rings{left:-15px!important;top:55px!important;bottom:45px!important}
 .rings i{width:25px!important}
 .tabs{
   top:-30px!important;left:9px!important;right:8px!important;
   width:calc(100% - 17px)!important;max-width:calc(100% - 17px)!important;
   min-width:0!important;display:flex!important;gap:4px!important;
   overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none!important;
   -webkit-overflow-scrolling:touch!important;scroll-snap-type:x proximity!important;
 }
 .tabs::-webkit-scrollbar{display:none!important}
 .tabs button{flex:0 0 auto!important;min-width:0!important;max-width:none!important;padding:10px 12px 8px!important;font-size:11px!important;scroll-snap-align:start!important}
 .tabs button.selected{padding-top:12px!important}
 .notebook .page{
   min-height:0!important;max-height:none!important;height:auto!important;
   display:block!important;flex:none!important;
   overflow:visible!important;scrollbar-gutter:auto!important;
   padding:7px 10px 20px 5px!important;
   overflow-wrap:anywhere!important;
 }
 .page>*{max-width:100%}
 .page-bottom{flex-wrap:wrap!important;gap:6px 12px!important}
 .page-bottom .footer-credit{flex:1 1 220px!important;line-height:1.5!important}
 .page-bottom #pageNumber{margin-left:auto!important}
 .ui-section{max-width:100%!important}
 .ui-form input:not([type=checkbox]):not([type=radio]),.ui-form select,.ui-form textarea{max-width:100%!important;min-width:0!important}
 .image-lightbox{padding:10px!important}
 .lightbox-shell{max-height:calc(100dvh - 20px)!important;overflow:auto!important}
 .shout-overlay{padding:12px!important}
 .shout-dialog{max-width:100%!important;max-height:calc(100dvh - 24px)!important;overflow-y:auto!important}
}
@media(max-width:600px){
 .topbar{gap:7px!important}
 .topbar .brand{font-size:11px!important;padding:8px 10px!important}
 .topbar .brand span{font-size:18px!important}
 .topbar .status.new-hud{gap:4px!important}
 .new-hud .hud-pill{font-size:10px!important;padding:7px 9px!important}
 .character-stage{height:clamp(125px,39vw,215px)!important;width:min(76vw,285px)!important}
 .journal{width:calc(100% - 18px)!important}
 .notebook{padding:45px 10px 12px 20px!important;border-width:5px!important}
 .notebook .page{padding:5px 9px 18px 4px!important}
 .page h2{font-size:clamp(17px,5vw,23px)!important}
 .page .intro,.ui-profile,.ui-feature{grid-template-columns:minmax(0,1fr)!important}
 .page .intro .polaroid{max-width:200px!important}
 .ui-profile img,.ui-feature-image{width:100%!important;max-width:300px!important;height:150px!important}
 .two-col,.ui-showcase,.ui-form-grid{grid-template-columns:minmax(0,1fr)!important}
 .projects{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
 .ui-palette{grid-template-columns:repeat(3,minmax(0,1fr))!important}
 .ui-stats{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important}
 .ui-stat{padding:8px 4px!important}
 .ui-hero-compact{grid-template-columns:minmax(0,1fr) 85px!important;padding:11px!important}
 .ui-hero-compact img{width:85px!important;height:100px!important}
 .ui-hero-compact h3{font-size:16px!important}
 .ui-timeline li{grid-template-columns:65px minmax(0,1fr)!important;gap:7px!important}
 .lightbox-stage{grid-template-columns:33px minmax(0,1fr) 33px!important;gap:4px!important}
 .lightbox-arrow{width:33px!important;height:44px!important}
 .lightbox-bottom{flex-wrap:wrap!important}
}
@media(max-width:390px){
 .topbar{justify-content:center!important}
 .topbar .brand{margin:0 auto!important}
 .topbar .status.new-hud{margin:0 auto!important;width:100%!important;justify-content:center!important}
 .sidebar nav button{padding:6px 10px!important}
 .character-stage{height:145px!important}
 .projects{grid-template-columns:minmax(0,1fr)!important}
 .ui-palette{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .ui-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .ui-hero-compact{grid-template-columns:minmax(0,1fr)!important}
 .ui-hero-compact img{display:none!important}
}
@media(prefers-reduced-motion:reduce){
 .sidebar nav,.tabs{scroll-behavior:auto!important}
}
