@import url("/css/responsive-all.css");

/* One shared navigation geometry for every route. */
body.site-shell>header{flex-shrink:0!important;box-sizing:border-box!important;height:64px!important;min-height:64px!important;max-height:none!important;padding:0 4%!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)!important;grid-template-rows:64px!important;gap:0 24px!important;align-items:center!important;position:fixed!important;inset:0 0 auto!important;width:100%!important;margin:0!important;background:#fff!important;border-bottom:1px solid #ececef!important;line-height:1.4!important;z-index:10000!important}
body.site-shell{padding-top:64px!important}
body.site-shell>header>.brand{grid-column:1!important;grid-row:1!important;justify-self:start!important;margin:0!important}
body.site-shell>header>nav{grid-column:2!important;grid-row:1!important;display:grid!important;grid-template-columns:repeat(9,44px)!important;gap:8px!important;width:auto!important;min-height:44px!important;height:44px!important;padding:0!important;margin:0!important;order:0!important;overflow:visible!important;align-items:center!important}
body.site-shell>header>nav>.nav{box-sizing:border-box!important;display:flex!important;align-items:center!important;justify-content:center!important;width:44px!important;min-width:0!important;height:44px!important;min-height:44px!important;margin:0!important;padding:10px!important;border:0!important;border-radius:12px!important;color:#858590!important;background:transparent!important;transform:none!important}
body.site-shell>header>nav>.nav svg{width:24px!important;height:24px!important;flex-shrink:0}
body.site-shell>header>nav>.nav:hover{background:#f5f5f7!important}
body.site-shell>header>nav>.nav[aria-current="page"]{background:#fbe9ed!important;color:#e4003a!important}
body.site-shell>header>.account-entry{grid-column:3!important;grid-row:1!important;justify-self:end!important;max-width:100%!important;min-height:36px!important;box-sizing:border-box!important;margin:0!important;padding:8px 16px!important;font:700 13.5px/20px 'Manrope',sans-serif!important;border-radius:999px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;background:#e4003a!important;color:white!important;text-decoration:none!important}
body.site-shell>header>.profile{display:none!important}
@media(max-width:1000px){
 body.site-shell{padding-top:0!important}
 body.site-shell>header{position:relative!important;height:116px!important;min-height:116px!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;grid-template-rows:56px 60px!important;padding:0 5%!important;gap:0!important}
 body.site-shell>header>.account-entry{grid-column:2!important;max-width:160px!important}
 body.site-shell>header>nav{grid-column:1 / -1!important;grid-row:2!important;grid-template-columns:repeat(9,minmax(0,44px))!important;width:100%!important;justify-content:center!important;gap:clamp(0px,.7vw,5px)!important}
 body.site-shell>header>nav>.nav{width:100%!important;padding:8px!important}
}
@media(max-width:360px){body.site-shell>header{padding-inline:12px!important}body.site-shell>header>.account-entry{max-width:136px!important;padding-inline:10px!important}body.site-shell>header>nav>.nav svg{width:22px!important;height:22px!important}}
/* Closed model controls must not remain keyboard-focusable. */
#modelDropdownWrap:not(.open) .gemini-popup-card{visibility:hidden!important;pointer-events:none!important}
#modelDropdownWrap.open .gemini-popup-card{visibility:visible!important;pointer-events:auto!important;max-width:calc(100vw - 32px)!important}

/* Shared stable loading and responsive surfaces. */
body.site-shell{opacity:1!important}
body.site-shell *,body.site-shell *::before,body.site-shell *::after{box-sizing:border-box}
body.site-shell img{max-width:100%;height:auto}
body.site-shell main,body.site-shell section,body.site-shell .learn-layout>*{min-width:0}
body.site-shell>header>nav>.nav[aria-current="page"]{box-shadow:inset 0 -3px #e4003a!important}
@media(max-width:1000px){
 body.site-shell .workspace{grid-template-columns:200px minmax(0,1fr)}
 body.site-shell .workspace>.inspector{grid-column:1/-1;border-left:0;border-top:1px solid var(--line,#ececef)}
 body.site-shell .clinical-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body.site-shell .learn-layout{grid-template-columns:minmax(0,1fr);gap:28px}
 body.site-shell .learning-side{position:static;max-width:none;width:100%}
}
@media(max-width:700px){
 body.site-shell>main{padding:24px 16px 0;width:100%;max-width:100%}
 body.site-shell .workspace{display:flex;flex-direction:column;min-height:0}
 body.site-shell .workspace>.layers{border-right:0;border-bottom:1px solid var(--line,#ececef);max-height:260px;overflow:auto;overscroll-behavior:contain;padding:18px}
 body.site-shell .viewport{min-height:440px;height:60svh;max-height:640px}
 body.site-shell .inspector{padding:20px}
 body.site-shell .clinical-grid{grid-template-columns:minmax(0,1fr)}
 body.site-shell .practice-shell{padding:20px 16px;margin-bottom:32px;width:100%}
 body.site-shell .practice-header,body.site-shell .study-toolbar,body.site-shell .page-heading{flex-wrap:wrap;gap:12px}
 body.site-shell .practice-header select{max-width:100%;margin-left:0}
 body.site-shell .question{font-size:clamp(20px,5.5vw,26px);overflow-wrap:anywhere}
 body.site-shell .flashcard{padding:28px 18px;min-height:280px;font-size:22px}
 body.site-shell .learn-layout{padding:24px 16px}
 body.site-shell dialog{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow-y:auto;padding:24px 18px}
 body.site-shell input:not([type=range]):not([type=checkbox]):not([type=radio]),body.site-shell select,body.site-shell textarea{font-size:16px}
 body.site-shell main>footer{flex-wrap:wrap;gap:12px}
 body.site-shell .account-panel{max-width:100%;padding-inline:20px}
 body.site-shell .pricing-section,body.site-shell .learning-options{padding-inline:20px!important}
 body.site-shell .gemini-popup-card{left:auto!important;right:0}
 body.site-shell #topbarActions .gemini-popup-card{left:0!important;right:auto}
 body.site-shell .a .txt{overflow-wrap:anywhere}
 body.site-shell .a .txt pre,body.site-shell .a .txt table{max-width:100%;overflow-x:auto}
}
@media(max-width:380px){body.site-shell .unit-body{flex-wrap:wrap;justify-content:center}body.site-shell .unit-orbit{flex-basis:150px}body.site-shell .unit-parts{width:100%}}
@media(prefers-reduced-motion:reduce){body.site-shell [data-r]{opacity:1!important;transform:none!important;filter:none!important}body.site-shell .tk{animation:none!important}body.site-shell{scroll-behavior:auto}body.site-shell *{transition-duration:0s!important}}
/* Keep system labels readable inside the actual sidebar width. */
body.site-shell #layers{grid-template-columns:repeat(2,minmax(0,1fr))!important}
body.site-shell #layers .layer{overflow-wrap:normal;word-break:normal;hyphens:none;padding:20px 6px 12px}
@media(min-width:701px) and (max-width:1100px){body.site-shell .workspace{grid-template-columns:250px minmax(0,1fr)}}
@media(max-width:700px){body.site-shell #layers{grid-template-columns:repeat(3,minmax(0,1fr))!important}}
@media(max-width:380px){body.site-shell #layers{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:1000px){
 body.miyobilab-home #home .hero{min-height:0;padding:48px 24px 56px}
 body.miyobilab-home #home .hero h1{font-size:clamp(34px,6.3vw,58px);line-height:1.12;letter-spacing:-.045em}
 body.miyobilab-home #home .hero>img{width:clamp(150px,24vw,220px)!important;margin-bottom:20px!important}
 body.miyobilab-home #home .hero .lead{font-size:18px;max-width:520px;margin-top:24px}
}
@media(max-width:480px){body.miyobilab-home #home .hero{padding:32px 18px 40px}body.miyobilab-home #home .hero h1 .l{white-space:normal}body.miyobilab-home .hero .cta{flex-wrap:wrap;justify-content:center;gap:12px}}
/* MiyoIA: explicit viewport regions, not a full-screen mobile rail. */
body.miyoia-app{--app-header:64px}
body.miyoia-app .rail{top:var(--app-header)!important;bottom:0!important;height:calc(100dvh - var(--app-header))!important}
body.miyoia-app[data-view=chat] #chat{top:auto!important;height:calc(100dvh - var(--app-header))!important;min-height:0!important;flex-shrink:0;padding-top:64px!important}
body.miyoia-app .chat-main{min-height:0;max-width:100%;height:100%;padding-inline:20px}
body.miyoia-app .msgs{min-height:0;overscroll-behavior:contain}
body.miyoia-app .stage{flex-shrink:0}
body.miyoia-app .mat-drawer{top:var(--app-header)!important;height:calc(100dvh - var(--app-header))!important}
@media(max-width:1000px){body.miyoia-app{--app-header:116px}}
@media(max-width:720px){
 body.miyoia-app[data-view=chat]{height:var(--app-height,100dvh);min-height:0!important;padding:0!important;overflow:hidden;display:flex;flex-direction:column}
 body.miyoia-app[data-view=chat] #chat{height:auto!important;flex:1 1 0;min-height:0!important;width:100%;padding:56px 0 calc(60px + env(safe-area-inset-bottom,0px))!important;overflow:hidden}
 body.miyoia-app[data-view=chat] .chat-main{padding:0 12px;min-height:0;height:100%}
 body.miyoia-app[data-view=chat] .rail{top:auto!important;bottom:0!important;left:0!important;width:100%!important;height:calc(56px + env(safe-area-inset-bottom,0px))!important;min-height:0;flex-direction:row;justify-content:center;align-items:center;padding:4px 16px env(safe-area-inset-bottom,0px);background:#fff;z-index:30}
 body.miyoia-app[data-view=chat][data-side=open] .rail{top:var(--app-header)!important;bottom:0!important;width:min(300px,86vw)!important;height:auto!important;flex-direction:column;align-items:stretch;justify-content:flex-start;padding:12px 14px}
 body.miyoia-app[data-view=chat] #topbarActions{position:fixed;top:calc(var(--app-header) + 6px)!important;left:12px!important;right:12px!important}
 body.miyoia-app[data-view=chat] .stage{margin:auto 0;max-height:100%;overflow-y:auto;padding-bottom:8px}
 body.miyoia-app[data-view=chat] #chat.has .stage{margin:0;overflow:visible}
 body.miyoia-app[data-view=chat] .stage h1{font-size:clamp(24px,6vw,32px);line-height:1.2;margin:12px 0 20px}
 body.miyoia-app[data-view=chat] .sugg{gap:6px;flex-wrap:wrap}
 body.miyoia-app[data-view=chat] .composer{width:100%;min-width:0}
 body.miyoia-app[data-view=chat] .composer textarea{max-height:120px;font-size:16px}
 body.miyoia-app .mat-drawer{max-width:100vw!important}
 body.miyoia-app .a{gap:8px}body.miyoia-app .a .bd{min-width:0}
}
@media(max-width:720px) and (max-height:650px){body.miyoia-app[data-view=chat] .stage h1{display:none}body.miyoia-app[data-view=chat] .sugg{display:none}}
/* Compact phone layout and one consistent overlay stack. */
@media(max-width:720px){
 body.site-shell>header{height:96px!important;min-height:96px!important;grid-template-rows:48px 48px!important;padding-inline:16px!important}
 body.site-shell>header>.brand{font-size:28px!important}
 body.site-shell>header>.account-entry{min-height:32px!important;padding:6px 12px!important;font-size:12px!important}
 body.site-shell>header>nav{height:40px!important;min-height:40px!important;grid-template-columns:repeat(9,minmax(0,40px))!important}
 body.site-shell>header>nav>.nav{height:40px!important;min-height:40px!important;padding:8px!important}
 body.site-shell>header>nav>.nav svg{width:22px!important;height:22px!important}
 body.miyoia-app{--app-header:96px}
 body.miyoia-app[data-view=chat] #chat{padding-top:52px!important;padding-bottom:calc(54px + env(safe-area-inset-bottom,0px))!important}
 body.miyoia-app[data-view=chat] .chat-main{padding-inline:16px!important}
 body.miyoia-app[data-view=chat] .stage{width:100%;margin:auto 0!important;padding-block:12px!important;overflow-y:auto}
 body.miyoia-app[data-view=chat] #chat.has .stage{margin:0!important;padding-top:4px!important}
 body.miyoia-app[data-view=chat] .stage h1{font-size:24px!important;line-height:1.3!important;letter-spacing:-.6px!important;margin:0 0 24px!important;overflow-wrap:break-word}
 body.miyoia-app[data-view=chat] .composer{padding:8px 10px!important;border:1px solid #e9e9ed!important;background:#fff!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;box-shadow:0 4px 16px #00000006!important;transform:none!important}
 body.miyoia-app[data-view=chat] .composer textarea{min-width:0;width:100%;font-size:16px!important;line-height:1.4}
 body.miyoia-app[data-view=chat] .send{width:36px!important;height:36px!important;flex-shrink:0}
 body.miyoia-app[data-view=chat] .sugg{display:flex;flex-wrap:nowrap!important;justify-content:flex-start!important;overflow-x:auto;max-width:100%;padding:3px 0 8px;gap:8px!important;scrollbar-width:none;margin-top:16px!important}
 body.miyoia-app[data-view=chat] .sugg button{flex:0 0 auto;max-width:90%;font-size:12px!important;padding:9px 12px!important;white-space:nowrap}
 body.miyoia-app[data-view=chat] .note{font-size:11px;line-height:1.45;padding:8px 8px 6px;flex-shrink:0}
 body.miyoia-app[data-view=chat] .rail{height:calc(50px + env(safe-area-inset-bottom,0px))!important}
 body.miyoia-app[data-side=open] .rail{z-index:10001!important;overflow-y:auto!important;background:#fff!important;backdrop-filter:none!important}
 body.miyoia-app[data-side=open] .scrim{display:block!important;position:fixed!important;inset:var(--app-header) 0 0!important;z-index:10000!important;background:#0005!important}
 body.miyoia-app[data-side=open] #topbarActions{visibility:hidden!important;pointer-events:none!important}
 body.miyoia-app[data-side=open] #chat{pointer-events:none}
 body.miyoia-app .rail .tg,body.miyoia-app .rail #nw{min-height:40px}
 body.miyoia-app .rail .hist{min-height:0;overflow:auto}
 body.miyoia-app .mat-drawer{z-index:10002!important;background:#fff!important}
}

/* Prevent accidental text selection while preserving editable controls. */
html body,html body *{-webkit-user-select:none!important;user-select:none!important}
html body input,html body textarea,html body [contenteditable]:not([contenteditable="false"]),html body [contenteditable]:not([contenteditable="false"]) *{-webkit-user-select:text!important;user-select:text!important}
html body :is(h1,h2,h3,h4,h5,h6)[tabindex="-1"]:focus{outline:none!important;box-shadow:none!important}
