/* MEGA TEAM V57 — responsive layout only. Existing palette, typography, assets,
   animation code and business logic remain intact. Desktop styles are untouched. */
@media screen and (max-width:1100px){
  body.mega-body .mega-site-header,body.mega-body .mega-nav-shell{max-width:100%;min-width:0}
  body.mega-body .mega-site-header:not(.mt53-header) .mega-nav-shell{position:relative;gap:12px}
  body.mega-body .mega-site-header:not(.mt53-header) .mega-brand{min-width:0;flex:0 1 auto}
  body.mega-body .mega-brand-icon{flex:none}
  body.mega-body .mega-brand-type{min-width:0;overflow-wrap:anywhere}
  body.mega-body .mega-site-header:not(.mt53-header) .mega-menu-toggle{display:block;flex:0 0 auto;min-width:44px;min-height:44px}
  body.mega-body .mega-site-header:not(.mt53-header) .mega-navigation{display:none;position:absolute;top:100%;inset-inline:12px;max-height:calc(100vh - 90px);max-height:calc(100dvh - 90px);overflow-y:auto;flex-direction:column;align-items:stretch;gap:6px;padding:15px;background:var(--academy-nav);color:var(--academy-ink);border:1px solid var(--academy-line);border-radius:0 0 18px 18px;box-shadow:var(--shadow);z-index:600}
  body.mega-body .mega-site-header:not(.mt53-header) .mega-navigation.is-open{display:flex}
  body.mega-body .mega-site-header:not(.mt53-header) .mega-navigation>a{white-space:normal;min-height:44px;padding:10px 12px}
  body.mega-body .mega-site-header:not(.mt53-header) .mega-nav-end{min-width:0;border-inline-start:0;border-top:1px solid var(--academy-line);padding:10px 0 0;flex-wrap:wrap}
  body.mega-body .mt-student-nav-header .mt-student-nav-actions{display:grid;grid-template-columns:auto minmax(0,1fr);gap:9px}
  body.mega-body .mt-student-nav-header .mt-student-account{grid-column:1/-1;width:100%}
  body.mega-body .mt-student-nav-header .mt-student-account-trigger{width:100%}
  body.mega-body .mt-student-nav-header .mt-student-account-label{display:block;flex:1;text-align:start}
  body.mega-body .mt-student-nav-header .mt-student-account-popover{position:static;max-width:none;width:100%;margin-top:7px;max-height:40dvh;overflow:auto}
}
@media screen and (max-width:840px){
  /* Two real rows, not an absolutely positioned logo sitting on a fixed height.
     The canvas and 3D image keep their original IDs and JavaScript. */
  body.mega-body.is-home .academy-hero{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;align-items:start;gap:0;width:100%;max-width:100%;min-width:0;min-height:0!important;padding:clamp(28px,6vw,50px) 0 0!important}
  body.mega-body.is-home .academy-hero-content{grid-row:1;grid-column:1;min-width:0;width:100%;max-width:100%!important;padding-inline:clamp(16px,5vw,36px);overflow-wrap:anywhere}
  body.mega-body.is-home .academy-hero-stage{position:relative;inset:auto;grid-row:2;grid-column:1;display:grid;place-items:center;z-index:0;width:100%;min-width:0;height:auto;min-height:0;aspect-ratio:auto;overflow:hidden;padding:clamp(18px,4vw,34px) clamp(15px,5vw,40px) clamp(24px,6vw,45px);isolation:isolate}
  body.mega-body.is-home #academy-logo-stage,html[dir=rtl] body.mega-body.is-home #academy-logo-stage{position:relative;inset:auto!important;width:min(100%,540px)!important;max-width:100%;height:auto;aspect-ratio:1417/838!important;--logo-tx:0%;--logo-ty:0%;--logo-base-ry:0deg;--logo-base-rx:0deg;margin:0 auto;z-index:2;justify-self:center;transform:translateY(var(--logo-float-y,0px)) rotateY(var(--logo-rot-y,0deg)) rotateX(var(--logo-rot-x,0deg))}
  body.mega-body.is-home #academy-logo-stage .academy-logo-hero{position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:contain!important}
  body.mega-body.is-home .academy-market-canvas,html[dir=rtl] body.mega-body.is-home .academy-market-canvas{mask-image:linear-gradient(to bottom,transparent 0%,#000 30%,#000 92%,transparent 100%)}
  body.mega-body.is-home .academy-scene-grid{mask-image:linear-gradient(to bottom,transparent,#000 40%,#000 90%,transparent)}
  body.mega-body.is-home .academy-floating{display:none}
  body.mega-body.is-home .academy-hero h1{max-width:100%;font-size:clamp(29px,6.2vw,48px)!important;text-wrap:balance}
  body.mega-body.is-home .academy-hero-description{max-width:580px;font-size:clamp(14px,2vw,16px)!important;line-height:1.7!important}
  body.mega-body.is-home .academy-hero-note{align-items:flex-start;max-width:100%}
  body.mega-body.is-home .academy-kicker{max-width:100%;font-size:10px;letter-spacing:.08em;line-height:1.5;white-space:normal}
  body.mega-body.is-home .academy-kicker-dot{flex:none}
  body.mega-body.is-home .academy-hero-ctas{display:flex;flex-wrap:wrap;align-items:stretch}
  body.mega-body.is-home .academy-hero-ctas .academy-btn{max-width:100%;white-space:normal;min-width:0}
  body.mega-body .mt56-launch{min-width:0;max-width:100%}
  body.mega-body .mt56-art-top,body.mega-body .mt56-art-bottom{flex-wrap:wrap;gap:6px;overflow-wrap:anywhere}
  body.mega-body .mt56-launch-cta{white-space:normal;min-width:0;max-width:100%;text-align:center}
  body.mega-body .mt18-home,body.mega-body .mt18-welcome,body.mega-body .mt48-course-card,body.mega-body .mt18-feedback,body.mega-body .cx-page,body.mega-body .cs-page,body.mega-body .topic-page-wrapper,body.mega-body .mt-profile-layout{min-width:0;max-width:100%;overflow-wrap:anywhere}
  body.mega-body :is(.mt18-welcome-main,.mt48-course-body,.mt48-progress-row>div,.mt46-catalog-progress>div,.cs-panel,.topic-body,.mt50-exam-copy,.mt53-main>*,.mt55-renew-intro>div){min-width:0;overflow-wrap:anywhere}
  body.mega-body :is(.topic-body,.cs-panel) :is(img,video,iframe){max-width:100%}
  body.mega-body .topic-body pre{max-width:100%;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere}
  body.mega-body .mt53-main{grid-template-columns:minmax(0,1fr);min-width:0}
  body.mega-body .mt53-table{max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-inline:contain}
  body.mt29-shell :is(.mt29-main,.mt29-work,.mt29-page-heading,.mt29-page-head,.mt29-main .panel,.mt29-main .card){min-width:0;max-width:100%;overflow-wrap:anywhere}
  body.mt29-shell .mt29-main :is(.table-responsive,.table-scroll,.table-scroll-viewport,.admin-table-wrapper,.mt31-user-table-wrap,.mt51-table-wrap){min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain}
  body.mt29-shell .mt29-main :is(input:not([type=checkbox]):not([type=radio]),select,textarea){min-width:0;max-width:100%}
}
@media screen and (max-width:600px){
  body.mega-body .mega-nav-shell{padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right));min-height:69px}
  body.mega-body .mega-brand{gap:8px}
  body.mega-body .mega-brand-icon,body.mega-body .mega-brand-icon img{width:40px;height:35px}
  body.mega-body .mega-brand-type{font-size:clamp(16px,4.5vw,20px)}
  body.mega-body .mega-brand-type small{font-size:clamp(7px,1.9vw,8px);letter-spacing:.1em;line-height:1.3}
  body.mega-body.is-home .academy-hero h1{font-size:clamp(30px,8.4vw,43px)!important}
  body.mega-body.is-home .academy-statbar>div{grid-template-columns:32px minmax(0,1fr);column-gap:8px;padding-inline:5px;overflow-wrap:anywhere}
  body.mega-body.is-home .academy-stat-icon{width:30px;height:30px}
  body.mega-body.is-home .academy-statbar{padding-inline:10px}
  body.mega-body .mt18-levels-heading{flex-wrap:wrap;gap:10px}
  body.mega-body .mt18-actions a,body.mega-body .mt48-btn,body.mega-body .cx-btn,body.mega-body .cs-cta{min-width:0;max-width:100%;white-space:normal;text-align:center}
  body.mega-body .mt48-course-frame{min-height:0;aspect-ratio:16/9}
  body.mega-body .mt48-progress-row,body.mega-body .mt46-catalog-progress{gap:10px}
  body.mega-body .mt48-progress-row .mt45-ring,body.mega-body .mt46-catalog-progress .mt45-ring{flex:0 0 74px;width:74px}
  body.mega-body .mt48-progress-row .mt45-ring-number,body.mega-body .mt46-catalog-progress .mt45-ring-number{font-size:18px!important}
  body.mega-body .mt48-progress-row .mt45-ring-label,body.mega-body .mt46-catalog-progress .mt45-ring-label{font-size:6px!important}
  body.mega-body .mt-auth-page{padding-inline:0}
  body.mega-body .mt-auth-main{padding-inline:clamp(16px,5vw,28px)}
  body.mega-body .mt-auth-label-row{flex-wrap:wrap;gap:5px}
  body.mega-body .mt-auth-form input:not([type=hidden]),body.mega-body .academy-contact-form :is(input,textarea),body.mega-body .mt-profile-field input{font-size:16px}
  body.mega-body .mt52-top-inner{flex-wrap:wrap;gap:10px}
  body.mega-body .mt52-brand{min-width:0;max-width:100%}
  body.mega-body .mt52-tools{flex-wrap:wrap}
  body.mega-body.mt53-page .mt53-nav-end{min-width:0}
  body.mega-body.mt53-page .mt53-tool{min-height:44px}
  body.mega-body.mt53-page .mt51-pagination{flex-wrap:wrap;overflow-wrap:anywhere}
  body.mega-body .mt55-renew-metrics a{min-width:0;overflow-wrap:anywhere}
  body.mega-body .mt55-filters a{min-height:40px;display:inline-flex;align-items:center}
  body.mega-body .mega-footer-inner nav{flex-wrap:wrap;gap:12px}
  body.mega-body .mega-copyright{overflow-wrap:anywhere}
  body.mt29-shell .mt29-main .mt29-page-head{flex-wrap:wrap}
  body.mt29-shell .mt29-main :is(.btn,button[type=submit]){max-width:100%;white-space:normal;overflow-wrap:anywhere}
  /* Standalone examination and certificate screens, excluding printed certificates. */
  body:has(#mt40-quiz) .wrap,body:has(.mt49-result-actions) .wrap{width:100%;max-width:100%;padding-inline:14px;overflow-wrap:anywhere}
  body:has(#mt40-quiz) .wrap header,body:has(.mt49-result-actions) .wrap header{flex-wrap:wrap}
  #mt40-quiz .card{padding:16px}
  #mt40-quiz .option span{min-width:0;overflow-wrap:anywhere}
  #mt40-quiz .option input{flex:none}
  #mt40-quiz>button[type=submit]{width:100%;min-height:48px}
  body.mt57-verify .card{box-sizing:border-box;width:calc(100% - 28px);max-width:650px;padding:20px;overflow-wrap:anywhere}
  body.mt57-certificate .certificate{box-sizing:border-box;width:calc(100% - 20px);margin:10px auto;padding:5% 5% 3%;font-size:clamp(8px,2.6vw,14px);gap:5px;min-height:0}
  body.mt57-certificate .certificate .head{gap:3px}
  body.mt57-certificate .certificate h1{font-size:clamp(13px,4vw,24px);margin:3px 0;line-height:1.15}
  body.mt57-certificate .certificate .subtitle{font-size:clamp(7px,2.1vw,12px);letter-spacing:.05em}
  body.mt57-certificate .certificate p{margin:3px 0}
  body.mt57-certificate .certificate .name{font-size:clamp(13px,4vw,23px)}
  body.mt57-certificate .certificate .title{font-size:clamp(10px,3vw,18px)}
  body.mt57-certificate .certificate .qr{width:clamp(44px,15vw,74px);height:clamp(44px,15vw,74px)}
  body.mt57-certificate .certificate small{font-size:clamp(7px,2vw,10px)}
  body.mt57-certificate .tools{overflow-wrap:anywhere}
}
@media screen and (max-width:360px){
  body.mega-body .mega-brand-icon,body.mega-body .mega-brand-icon img{width:32px;height:32px}
  body.mega-body .mega-brand-type{font-size:16px}
  body.mega-body .mega-brand-type small{letter-spacing:.04em}
  body.mega-body.is-home .academy-hero-ctas .academy-btn{flex:1 1 100%}
  body.mega-body .mt55-renew-metrics{grid-template-columns:minmax(0,1fr)}
  body.mega-body .mt48-progress-row{align-items:center}
}
@media screen and (min-width:841px) and (max-width:1100px){
  body.mega-body.is-home #academy-logo-stage{left:54%!important;width:43%!important;--logo-tx:0%;--logo-base-ry:0deg}
  html[dir=rtl] body.mega-body.is-home #academy-logo-stage{left:3%!important;--logo-tx:0%;--logo-base-ry:0deg}
}

/* V57.1 — keep the educational note icon next to its first text line. */
@media screen and (max-width:840px){
  body.mega-body.is-home .academy-hero-note{
    display:flex;align-items:flex-start;justify-content:flex-start;
    gap:4px;line-height:16px;max-width:100%;text-align:start;
  }
  body.mega-body.is-home .academy-hero-note>span[aria-hidden="true"]{
    flex:0 0 auto;display:block;width:auto;min-width:0;
    font-size:13px;line-height:16px;margin:0;padding:0;
    align-self:flex-start;
  }
}
