/* Classivo mobile layout – additive responsive rules only. */
html{ -webkit-text-size-adjust:100%; }
*,*::before,*::after{box-sizing:border-box}
img,video,svg{max-width:100%;height:auto}
@media(max-width:767px){
 html,body{max-width:100%;margin-left:0;margin-right:0;overflow-x:clip}
 input,select,textarea{max-width:100%;min-width:0;font-size:max(16px,1em)}
 button,a,summary{touch-action:manipulation}
 .panel,.card,.student,.group-card,.modal,.game-sidebar,.game-main{min-width:0;max-width:100%}
 .cards,.groups-grid,.class-cards,.classes-grid{grid-template-columns:minmax(0,1fr)!important}
 .teacher-section-nav{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 .teacher-section-nav .tabs{display:flex;flex-wrap:nowrap;width:max-content;min-width:100%;gap:6px}
 .teacher-section-nav .tabs button{flex-shrink:0;white-space:nowrap}
 .teacher-home-nav{max-width:100%;gap:8px;flex-wrap:wrap}
 .teacher-home-nav h1{max-width:100%;min-width:0}
 .teacher-home-nav .auth-header-actions{display:flex;flex-wrap:wrap;gap:6px;justify-content:center}
 .section-head,.student-actions,.group-actions{gap:10px}
 .groups-grid{width:100%}
 #classivoAddGroupPanel,.classivo-add-group{max-width:100%;min-width:0}
 #classivoAddGroupPanel select,#classivoAddGroupPanel button{max-width:100%}
 dialog,.modal,[role="dialog"]{max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow-y:auto}
 .game-layout{grid-template-columns:minmax(0,1fr)!important}
 .game-main .game-board{grid-template-columns:repeat(3,minmax(0,1fr))!important}
 .game-tile{min-width:0}
 main,.wrap{max-width:100%;min-width:0}
}
@media(max-width:390px){
 .game-main .game-board{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .teacher-home-nav .auth-header-actions button{font-size:13px}
}
@media(min-width:768px) and (max-width:1024px){
 .cards,.groups-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .game-layout{grid-template-columns:minmax(0,1fr)}
}

/* Keep the classroom header inside narrow device viewports. */
@media(max-width:767px){
 body>header,body>header>nav, .teacher-home-nav{width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box}
 .teacher-home-nav{padding:10px 12px!important;gap:8px!important}
 .teacher-home-nav h1{min-width:0!important;max-width:100%!important;text-align:center}
 .teacher-home-nav .classivo-header-logo{max-width:min(170px,65vw)!important;height:auto!important}
 .teacher-nav-left,.teacher-home-nav .auth-header-actions{min-width:0!important;max-width:100%!important}
 .teacher-home-nav #authJoin{max-width:100%;white-space:normal}
 body>header>p{overflow-wrap:anywhere;max-width:100%;box-sizing:border-box}
}

/* Phone-first classroom layout. Scoped to small screens; desktop unchanged. */
@media (max-width: 600px) {
 html,body{width:100%;max-width:100%;overflow-x:hidden!important}
 header{width:100%;max-width:100%;overflow:hidden}
 header .teacher-home-nav{display:grid!important;grid-template-columns:42px minmax(0,1fr) 42px!important;grid-template-areas:'home logo menu' 'auth auth auth'!important;align-items:center!important;justify-items:center!important;padding:12px 10px 8px!important;gap:8px!important}
 .teacher-home-nav .teacher-nav-left{grid-area:home!important;justify-self:start!important}
 .teacher-home-nav h1{grid-area:logo!important;width:100%!important;margin:0!important;line-height:1!important;display:flex!important;justify-content:center!important}
 .teacher-home-nav .classivo-logo-wrap{max-width:100%!important;display:flex!important;justify-content:center!important}
 .teacher-home-nav .classivo-header-logo{width:auto!important;height:auto!important;max-height:58px!important;max-width:210px!important;object-fit:contain!important}
 .teacher-home-nav .auth-header-actions{grid-area:auth!important;width:100%!important;display:flex!important;justify-content:center!important;align-items:center!important;gap:10px!important;margin:0!important}
 .teacher-home-nav .auth-header-actions button{font-size:13px!important;padding:8px 12px!important;min-height:36px!important;width:auto!important;max-width:48%!important;white-space:nowrap!important}
 header>p{font-size:11px!important;line-height:1.45!important;padding:0 14px 10px!important;margin:0!important;text-align:center!important}
 .teacher-section-nav{width:100%!important;padding:6px 8px!important;overflow-x:auto!important}
 .teacher-section-nav .tabs{width:max-content!important;min-width:100%!important;gap:6px!important;flex-wrap:nowrap!important}
 .teacher-section-nav .tab{font-size:12px!important;padding:9px 10px!important;min-height:38px!important;white-space:nowrap!important;flex:0 0 auto!important}
 #lessonPanel{padding:16px 12px!important;width:100%!important;min-width:0!important}
 #lessonPanel>.row:first-child{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:12px!important}
 #lessonPanel>.row:first-child h2{font-size:clamp(20px,6vw,26px)!important;line-height:1.2!important;flex:initial!important;margin:0!important;min-width:0!important}
 #createLessonBeforeGame{width:100%!important;max-width:100%!important;align-self:stretch!important;white-space:normal!important;font-size:15px!important;padding:12px!important}
 #lessonGrid:not(.cvg-js){display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:14px!important;width:100%!important}
 #lessonGrid:not(.cvg-js)>*{width:100%!important;min-width:0!important;max-width:100%!important}
 #lessonGrid img{max-width:100%!important;object-fit:cover}
 .panel{min-width:0!important;max-width:100%!important}
}
