/* Touch layout is intentionally loaded after every desktop stylesheet. */
.mobile-bottom-nav,
.mobile-display-tool,
.mobile-only-menu-item,
.mobile-more-sheet{
  display:none!important;
}

.podium-mobile-name-card{
  display:none;
}

@media (max-width:1024px), (max-width:1366px) and (hover:none) and (pointer:coarse){
  :root{
    --touch-nav-height:68px;
  }

  html{
    max-width:100%;
    overflow-x:hidden;
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
  }

  body{
    width:100%;
    max-width:100%;
    min-height:100dvh;
    overflow-x:hidden;
    padding-bottom:calc(var(--touch-nav-height) + env(safe-area-inset-bottom,0px))!important;
    touch-action:manipulation;
  }

  button,
  input,
  select,
  textarea{
    min-width:0;
  }

  button,
  [role="button"],
  .upload-label{
    -webkit-tap-highlight-color:transparent;
  }

  .dashboard-app{
    width:100%;
    min-height:calc(100dvh - var(--touch-nav-height));
    overflow:visible;
  }

  body .dashboard-header{
    position:sticky!important;
    top:0!important;
    z-index:48!important;
    width:calc(100% - 20px)!important;
    max-width:none!important;
    min-height:0!important;
    height:auto!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-areas:"brand" "search"!important;
    gap:8px!important;
    margin:0 10px!important;
    padding:9px 10px 10px!important;
    border-radius:0 0 22px 22px!important;
    background:rgba(255,255,255,.94)!important;
    box-shadow:0 10px 28px var(--theme-shadow)!important;
    backdrop-filter:blur(18px)!important;
    -webkit-backdrop-filter:blur(18px)!important;
  }

  body .dashboard-header .header-brand{
    grid-area:brand!important;
    width:100%!important;
    display:grid!important;
    grid-template-columns:42px minmax(76px,1fr) auto auto auto!important;
    align-items:center!important;
    gap:7px!important;
  }

  body .dashboard-header .strawberry-logo{
    width:42px!important;
    height:42px!important;
    min-width:42px!important;
    padding:5px!important;
  }

  body .dashboard-header .class-selector{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    min-height:44px!important;
    justify-content:flex-start!important;
    padding:0 8px!important;
    overflow:hidden!important;
  }

  body .dashboard-header .class-selector strong{
    min-width:0!important;
    overflow:hidden!important;
    font-size:15px!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  body .dashboard-header .top-primary-tool,
  body .dashboard-header .mobile-display-tool{
    min-width:64px!important;
    min-height:44px!important;
    height:44px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:5px!important;
    padding:0 10px!important;
    border:1px solid var(--theme-border)!important;
    border-radius:999px!important;
    background:linear-gradient(180deg,#fff,var(--theme-soft))!important;
    color:var(--theme-text)!important;
    box-shadow:0 5px 14px var(--theme-shadow)!important;
    font-size:12px!important;
    font-weight:900!important;
  }

  body .dashboard-header .top-primary-tool svg,
  body .dashboard-header .mobile-display-tool svg{
    width:19px!important;
    height:19px!important;
    flex:0 0 auto!important;
  }

  body .dashboard-header .top-sort-wrap{
    min-width:0!important;
  }

  body .dashboard-header .top-sort-menu{
    z-index:110!important;
    width:min(310px,calc(100vw - 24px))!important;
    max-height:min(410px,70dvh)!important;
    overflow:auto!important;
  }

  body .dashboard-header .main-nav{
    display:none!important;
  }

  body .dashboard-header .header-right{
    grid-area:search!important;
    width:100%!important;
    min-width:0!important;
    display:flex!important;
    justify-content:stretch!important;
  }

  body .dashboard-header .top-icon-tool,
  body .dashboard-header .top-utility-tool,
  body .dashboard-header .teacher-avatar.more-trigger,
  body .dashboard-header .top-divider{
    display:none!important;
  }

  body .dashboard-header .more-wrap{
    width:0!important;
    height:0!important;
    position:static!important;
  }

  body .dashboard-header .dashboard-search{
    order:0!important;
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    height:44px!important;
    display:flex!important;
    flex:1 1 100%!important;
    margin:0!important;
  }

  body .dashboard-header .dashboard-search input{
    min-width:0!important;
    height:44px!important;
    padding-right:16px!important;
    font-size:16px!important;
  }

  body .dashboard-header .more-menu{
    position:fixed!important;
    z-index:120!important;
    top:auto!important;
    right:12px!important;
    bottom:calc(var(--touch-nav-height) + env(safe-area-inset-bottom,0px) + 10px)!important;
    width:min(360px,calc(100vw - 24px))!important;
    max-height:min(480px,calc(100dvh - 110px))!important;
    overflow:auto!important;
    transform:none!important;
  }

  body .dashboard-header .more-menu>button,
  body .dashboard-header .mobile-only-menu-item{
    min-height:52px!important;
  }

  body .dashboard-header .mobile-only-menu-item{
    display:flex!important;
  }

  .dashboard-main{
    width:100%!important;
    max-width:100%!important;
    padding:14px 12px 30px!important;
  }

  .dashboard-main>#classroom.active-view,
  .dashboard-view{
    width:100%!important;
    display:block!important;
  }

  .left-panel{
    width:100%!important;
    min-height:0!important;
    margin:0 0 14px!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    box-shadow:none!important;
    overflow:visible!important;
  }

  .left-panel::before,
  .left-panel::after,
  .class-summary,
  .class-growth-card,
  .right-panel{
    display:none!important;
  }

  .sidebar-groups{
    width:100%!important;
    display:flex!important;
    gap:9px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:4px 1px 9px!important;
    scroll-snap-type:x proximity;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }

  .sidebar-groups::-webkit-scrollbar{
    display:none;
  }

  .sidebar-groups button{
    width:auto!important;
    min-width:max-content!important;
    min-height:44px!important;
    height:44px!important;
    flex:0 0 auto!important;
    scroll-snap-align:start;
    padding:0 16px!important;
    border:1px solid var(--theme-border)!important;
    border-radius:999px!important;
    background:rgba(255,255,255,.92)!important;
    color:var(--theme-text)!important;
    box-shadow:0 5px 13px rgba(100,116,139,.07)!important;
  }

  .sidebar-groups button.active{
    border-color:transparent!important;
    background:linear-gradient(135deg,var(--theme-2),var(--theme))!important;
    color:#fff!important;
    box-shadow:0 8px 18px var(--theme-shadow)!important;
  }

  .sidebar-groups button i{
    display:none!important;
  }

  .center-panel{
    width:100%!important;
    min-width:0!important;
  }

  .student-section-head{
    margin:4px 2px 13px!important;
  }

  .student-section-head h2{
    font-size:20px!important;
  }

  .student-section-head p{
    display:block!important;
    margin:4px 0 0!important;
    color:#94a3b8!important;
    font-size:11px!important;
  }

  .dashboard-student-grid{
    width:100%!important;
    max-height:none!important;
    overflow:visible!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:14px!important;
    padding:0!important;
  }

  .dashboard-student-grid .growth-star-card{
    min-width:0!important;
    min-height:250px!important;
    height:auto!important;
    padding:16px 13px 13px!important;
    border-radius:22px!important;
  }

  .dashboard-student-grid .growth-star-card h3{
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .dashboard-student-grid .growth-star-card .score-line{
    min-width:0!important;
    gap:7px!important;
  }

  .dashboard-student-grid .growth-star-card .score-line span{
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .overlay-page,
  #rewards{
    width:100%!important;
    max-width:100%!important;
    min-height:0!important;
    margin:0!important;
    padding:22px 18px!important;
    border-radius:24px!important;
  }

  .section-heading{
    gap:12px!important;
  }

  .section-heading h2{
    font-size:24px!important;
  }

  .section-heading button,
  .store-tabs button,
  .segmented button{
    min-height:44px!important;
  }

  .store-tabs,
  .segmented{
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scrollbar-width:none;
  }

  .store-tabs::-webkit-scrollbar,
  .segmented::-webkit-scrollbar{
    display:none;
  }

  .ranking-list,
  .history-card,
  .student-table,
  .store-record-table{
    max-width:100%!important;
  }

  .rank-row{
    grid-template-columns:48px minmax(0,1fr) 105px 76px!important;
    gap:8px!important;
  }

  .modal{
    z-index:130!important;
    min-height:100dvh!important;
    padding:max(10px,env(safe-area-inset-top,0px)) 10px calc(10px + env(safe-area-inset-bottom,0px))!important;
    align-items:center!important;
  }

  .modal-panel,
  .settings-panel,
  .modal-panel.class-manager-modal,
  .modal-panel.reward-editor-modal,
  .modal-panel.group-center-modal,
  .modal-panel.avatar-crop-modal,
  .modal-panel.avatar-batch-modal{
    width:min(760px,100%)!important;
    max-width:100%!important;
    max-height:calc(100dvh - 20px)!important;
    border-radius:22px!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch;
  }

  .modal-close,
  .settings-header button,
  .group-center-close,
  [data-group-icon-picker-backdrop] button,
  .back-classroom{
    min-width:44px!important;
    min-height:44px!important;
  }

  .score-option,
  .modal-form input,
  .modal-form select,
  .modal-form textarea,
  .custom-score-actions button,
  .profile-score-actions button{
    min-height:44px!important;
  }

  .batch-bar{
    z-index:70!important;
    bottom:calc(var(--touch-nav-height) + env(safe-area-inset-bottom,0px) + 8px)!important;
    width:calc(100% - 20px)!important;
    max-width:760px!important;
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:7px!important;
    padding:10px!important;
    border-radius:20px!important;
  }

  .batch-bar>div{
    grid-column:1/-1!important;
    min-width:0!important;
    text-align:center!important;
  }

  .batch-bar button{
    min-width:0!important;
    min-height:44px!important;
    padding:8px 6px!important;
    font-size:12px!important;
  }

  .batch-bar.hidden{
    display:none!important;
  }

  .toast{
    z-index:150!important;
    right:50%!important;
    bottom:calc(var(--touch-nav-height) + env(safe-area-inset-bottom,0px) + 12px)!important;
    width:max-content!important;
    max-width:calc(100% - 24px)!important;
    transform:translate(50%,12px)!important;
    border-radius:16px!important;
    text-align:center!important;
    white-space:normal!important;
  }

  .toast.show{
    transform:translate(50%,0)!important;
  }

  body.batch-mode .toast{
    bottom:calc(var(--touch-nav-height) + env(safe-area-inset-bottom,0px) + 126px)!important;
  }

  .mobile-bottom-nav{
    position:fixed!important;
    z-index:65!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    height:calc(var(--touch-nav-height) + env(safe-area-inset-bottom,0px))!important;
    display:grid!important;
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    align-items:start!important;
    padding:6px 4px env(safe-area-inset-bottom,0px)!important;
    border-top:1px solid color-mix(in srgb,var(--theme-border) 70%,white)!important;
    background:rgba(255,255,255,.96)!important;
    box-shadow:0 -10px 28px var(--theme-shadow)!important;
    backdrop-filter:blur(20px)!important;
    -webkit-backdrop-filter:blur(20px)!important;
  }

  body.modal-open .mobile-bottom-nav,
  body.modal-open .mobile-more-sheet,
  body.modal-open .batch-bar{
    visibility:hidden!important;
    opacity:0!important;
    pointer-events:none!important;
  }

  .mobile-bottom-nav button{
    min-width:0!important;
    min-height:56px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:2px!important;
    padding:3px 1px!important;
    border:0!important;
    border-radius:14px!important;
    background:transparent!important;
    color:#94a3b8!important;
    font-size:10px!important;
    font-weight:900!important;
  }

  .mobile-bottom-nav button svg{
    width:23px!important;
    height:23px!important;
  }

  .mobile-bottom-nav button>b{
    height:23px!important;
    font-size:21px!important;
    line-height:21px!important;
  }

  .mobile-bottom-nav button.active,
  .mobile-bottom-nav button:active{
    background:var(--theme-soft)!important;
    color:var(--theme)!important;
  }

  .mobile-more-sheet{
    position:fixed!important;
    z-index:74!important;
    right:12px!important;
    bottom:calc(var(--touch-nav-height) + env(safe-area-inset-bottom,0px) + 10px)!important;
    width:min(360px,calc(100vw - 24px))!important;
    max-height:calc(100dvh - var(--touch-nav-height) - 32px)!important;
    display:grid!important;
    gap:4px!important;
    overflow:auto!important;
    padding:9px!important;
    border:1px solid color-mix(in srgb,var(--theme-border) 72%,white)!important;
    border-radius:20px!important;
    background:rgba(255,255,255,.98)!important;
    box-shadow:0 20px 48px rgba(30,41,59,.22),0 0 0 1px rgba(255,255,255,.72)!important;
    backdrop-filter:blur(20px)!important;
    -webkit-backdrop-filter:blur(20px)!important;
  }

  .mobile-more-sheet.hidden{
    display:none!important;
  }

  .mobile-more-sheet button{
    width:100%!important;
    min-height:58px!important;
    display:flex!important;
    align-items:center!important;
    gap:11px!important;
    padding:9px 12px!important;
    border:0!important;
    border-radius:14px!important;
    background:transparent!important;
    color:var(--theme-text)!important;
    text-align:left!important;
    font-size:18px!important;
    font-weight:900!important;
  }

  .mobile-more-sheet button:active{
    background:var(--theme-soft)!important;
  }

  .mobile-more-sheet button span{
    min-width:0!important;
    display:grid!important;
    gap:2px!important;
  }

  .mobile-more-sheet button b,
  .mobile-more-sheet button small{
    display:block!important;
  }

  .mobile-more-sheet button b{
    font-size:14px!important;
  }

  .mobile-more-sheet button small{
    color:#94a3b8!important;
    font-size:10px!important;
    font-weight:700!important;
  }

  .level-up-celebration{
    min-height:100dvh!important;
    padding:max(14px,env(safe-area-inset-top,0px)) 14px calc(14px + env(safe-area-inset-bottom,0px))!important;
  }

  .level-up-card{
    width:min(520px,96vw)!important;
    max-height:calc(100dvh - 28px)!important;
    overflow:auto!important;
  }

  .avatar-student-row>.avatar-row-actions{
    display:flex!important;
    visibility:visible!important;
    opacity:1!important;
    pointer-events:auto!important;
  }

  .avatar-row-actions .upload-label,
  .avatar-row-actions .avatar-remove-button{
    min-height:44px!important;
  }

  .podium.ranking-name-mode .avatar-wrap{
    display:none!important;
  }

  .podium.ranking-name-mode .podium-mobile-name-card{
    width:100%;
    min-height:88px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:9px auto 10px;
    padding:10px 6px;
    border:2px solid var(--theme-border);
    border-radius:20px;
    background:linear-gradient(145deg,#fff,var(--theme-soft));
    color:var(--theme-text);
    font-size:clamp(18px,4vw,27px);
    font-weight:950;
    line-height:1.18;
    overflow-wrap:anywhere;
    text-align:center;
  }

  .podium.ranking-name-mode .podium-student-name{
    display:none!important;
  }
}

@media (max-width:900px){
  .dashboard-student-grid{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }

  .reward-grid,
  #rewards .reward-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .podium{
    gap:9px!important;
  }

  .group-assign-layout,
  .group-manage-layout{
    grid-template-columns:1fr!important;
  }

  .group-student-list,
  .group-manage-left,
  .group-member-panel{
    min-height:0!important;
    max-height:42dvh!important;
  }

  .avatar-student-row{
    grid-template-columns:52px minmax(0,1fr) 118px 170px 82px!important;
  }

}

@media (max-width:680px){
  :root{
    --touch-nav-height:66px;
  }

  body .dashboard-header{
    width:100%!important;
    margin:0!important;
    padding:8px 8px 9px!important;
    border-radius:0 0 19px 19px!important;
  }

  body .dashboard-header .header-brand{
    grid-template-columns:38px minmax(66px,1fr) 54px 54px 54px!important;
    gap:4px!important;
  }

  body .dashboard-header .strawberry-logo{
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
  }

  body .dashboard-header .class-selector{
    padding:0 4px!important;
  }

  body .dashboard-header .class-selector strong{
    font-size:12px!important;
  }

  body .dashboard-header .top-primary-tool,
  body .dashboard-header .mobile-display-tool{
    width:54px!important;
    min-width:54px!important;
    padding:0 4px!important;
    gap:2px!important;
    font-size:10px!important;
  }

  body .dashboard-header .top-primary-tool svg,
  body .dashboard-header .mobile-display-tool svg{
    width:17px!important;
    height:17px!important;
  }

  #topSortLabel{
    font-size:0!important;
  }

  #topSortLabel::after{
    content:"排序";
    font-size:10px;
  }

  .dashboard-main{
    padding:12px 8px 24px!important;
  }

  .sidebar-groups{
    gap:7px!important;
  }

  .sidebar-groups button{
    min-height:42px!important;
    height:42px!important;
    padding:0 13px!important;
    font-size:12px!important;
  }

  .sidebar-groups button span svg{
    width:18px!important;
    height:18px!important;
  }

  .dashboard-student-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:11px 9px!important;
  }

  .dashboard-student-grid .growth-star-card{
    min-height:252px!important;
    padding:14px 10px 11px!important;
    border-radius:20px!important;
    text-align:center!important;
  }

  .dashboard-student-grid .growth-star-card .star-card-top{
    left:9px!important;
    top:9px!important;
  }

  .dashboard-student-grid .growth-star-card .avatar-wrap{
    width:min(112px,72%)!important;
    height:auto!important;
    aspect-ratio:1!important;
    float:none!important;
    margin:8px auto 10px!important;
  }

  .dashboard-student-grid .growth-star-card h3{
    clear:both!important;
    margin:5px 0 5px!important;
    font-size:15px!important;
  }

  .dashboard-student-grid .growth-star-card .honor-title{
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .dashboard-student-grid .growth-star-card .score-line{
    justify-content:space-between!important;
    padding-top:5px!important;
    font-size:9px!important;
  }

  .dashboard-student-grid .growth-star-card .score-line b{
    font-size:17px!important;
  }

  .dashboard-student-grid .growth-star-card .mini-badges{
    justify-content:center!important;
  }

  .overlay-page,
  #rewards{
    padding:18px 12px!important;
    border-radius:20px!important;
  }

  .section-heading{
    align-items:flex-start!important;
    margin-bottom:15px!important;
  }

  .section-heading h2{
    font-size:21px!important;
  }

  .section-heading p:not(.eyebrow){
    display:none!important;
  }

  .section-heading>div:last-child{
    flex:0 0 auto!important;
  }

  .section-heading .soft-button{
    width:44px!important;
    padding:0!important;
    overflow:hidden!important;
    font-size:0!important;
  }

  .section-heading .soft-button::before{
    content:"↶";
    font-size:22px;
  }

  .section-heading .report-export-button::before{
    content:"⇩";
  }

  .store-tabs,
  .segmented{
    width:100%!important;
    margin-bottom:16px!important;
  }

  .store-tabs button,
  .segmented button{
    flex:1 0 auto!important;
    padding:8px 10px!important;
    font-size:11px!important;
  }

  .reward-grid,
  #rewards .reward-grid{
    grid-template-columns:1fr!important;
  }

  .podium{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:5px!important;
    margin:18px auto 16px!important;
  }

  .podium-card,
  .podium-card.first{
    min-width:0!important;
    padding:12px 5px!important;
    border-radius:17px!important;
  }

  .podium-card .avatar-wrap{
    width:min(70px,72%)!important;
    height:auto!important;
    aspect-ratio:1!important;
  }

  .podium-card strong{
    min-height:2.6em!important;
    display:-webkit-box!important;
    overflow:hidden!important;
    -webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    line-height:1.3!important;
  }

  .podium-card .avatar,
  .podium-card .avatar img{
    width:100%!important;
    height:100%!important;
  }

  .podium-card .avatar img{
    object-fit:cover!important;
  }

  .podium.ranking-name-mode .podium-mobile-name-card{
    min-height:78px;
    margin:7px auto 8px;
    padding:8px 4px;
    border-radius:16px;
    font-size:clamp(17px,5.5vw,24px);
  }

  .rank-row{
    grid-template-columns:40px minmax(0,1fr) 66px!important;
    gap:7px!important;
    padding:11px 9px!important;
    font-size:11px!important;
  }

  #rankingList .mini-person,
  #rankingList .mini-person>span{
    min-width:0!important;
  }

  #rankingList .mini-person>span{
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .rank-row>*:nth-child(3){
    display:none!important;
  }

  .history-head{
    display:none!important;
  }

  .history-row{
    min-height:82px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:4px 10px!important;
    padding:12px!important;
  }

  .history-row>*{
    min-width:0!important;
  }

  .history-row>*:nth-child(1){
    grid-column:1!important;
    grid-row:3!important;
    color:#94a3b8!important;
    font-size:10px!important;
  }

  .history-row>*:nth-child(2){
    grid-column:1!important;
    grid-row:1!important;
    overflow:hidden!important;
    font-weight:900!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .history-row>*:nth-child(3){
    grid-column:1!important;
    grid-row:2!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .history-row>*:nth-child(4){
    grid-column:2!important;
    grid-row:1/4!important;
    align-self:center!important;
    font-size:17px!important;
  }

  .history-row>*:nth-child(5){
    display:none!important;
  }

  .student-row,
  .avatar-student-row{
    min-height:104px!important;
    grid-template-columns:48px minmax(0,1fr) 86px!important;
    gap:9px!important;
    padding:10px!important;
  }

  .student-row>*:nth-child(4),
  .avatar-level-label,
  .avatar-student-row .row-action{
    display:none!important;
  }

  .avatar-row-actions{
    grid-column:2/4!important;
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:7px!important;
  }

  .avatar-student-row>.avatar-row-actions{
    display:flex!important;
    grid-row:2!important;
    align-self:start!important;
    visibility:visible!important;
    opacity:1!important;
    pointer-events:auto!important;
  }

  .avatar-student-row>.avatar-row-actions>*{
    min-width:0!important;
    min-height:44px!important;
    flex:1 1 0!important;
  }

  .score-options{
    grid-template-columns:1fr!important;
  }

  .modal-panel,
  .settings-panel,
  .modal-panel.class-manager-modal,
  .modal-panel.reward-editor-modal,
  .modal-panel.avatar-crop-modal{
    padding:20px 15px!important;
    border-radius:19px!important;
  }

  .settings-panel,
  .modal-panel.group-center-modal,
  .modal-panel.avatar-batch-modal{
    height:calc(100dvh - 12px)!important;
    max-height:calc(100dvh - 12px)!important;
    padding:0!important;
  }

  .settings-header{
    padding:13px 14px!important;
  }

  .settings-header h2{
    font-size:18px!important;
  }

  .draft-state{
    display:none!important;
  }

  .settings-scroll{
    padding:10px!important;
    gap:11px!important;
    grid-auto-rows:max-content!important;
    align-content:start!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
  }

  .settings-section{
    padding:13px!important;
    content-visibility:visible!important;
    contain-intrinsic-size:none!important;
  }

  .settings-grid-two,
  .settings-actions,
  .support-section,
  .reward-product-form{
    grid-template-columns:1fr!important;
  }

  .theme-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .stage-frame-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .settings-score-list{
    grid-template-columns:1fr!important;
  }

  .settings-score-list>div{
    grid-template-columns:34px minmax(0,1fr) 42px 44px!important;
    gap:5px!important;
  }

  .score-settings-section .settings-score-list>div{
    grid-template-columns:28px minmax(0,1fr) 38px 38px 34px!important;
  }

  .score-add-row,
  .add-score-row{
    grid-template-columns:48px minmax(0,1fr) 76px!important;
  }

  .score-add-row button:last-child,
  .add-score-row button:last-child{
    grid-column:1/-1!important;
    min-height:44px!important;
  }

  .feature-card,
  .switch-row,
  .setting-title{
    align-items:flex-start!important;
  }

  .feature-card{
    flex-direction:column!important;
  }

  .feature-card button{
    width:100%!important;
    min-height:44px!important;
  }

  .settings-student-list>div{
    grid-template-columns:25px 38px minmax(0,1fr) 44px 44px!important;
  }

  .settings-student-list small{
    display:none!important;
  }

  .settings-footer{
    padding:9px 10px calc(9px + env(safe-area-inset-bottom,0px))!important;
  }

  .settings-footer button{
    min-height:44px!important;
    flex:1!important;
  }

  .reward-field,
  .reward-name-field,
  .reward-desc-field,
  .reward-palette-picker,
  .reward-icon-picker,
  .reward-editor-actions{
    grid-column:1!important;
  }

  .reward-palette-picker{
    flex-wrap:wrap!important;
  }

  .reward-icon-options{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
  }

  .reward-editor-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
  }

  .store-record-table{
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
  }

  .store-record-head,
  .store-record-row{
    min-width:590px!important;
  }

  .class-manager-card{
    grid-template-columns:46px minmax(0,1fr)!important;
    gap:9px!important;
  }

  .class-manager-actions{
    grid-column:1/-1!important;
    grid-row:auto!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
  }

  .class-manager-actions button{
    min-height:42px!important;
    background:var(--theme-soft)!important;
  }

  .class-manager-editor>div,
  .class-delete-confirm footer{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
  }

  .group-center-head{
    padding:14px 13px 10px!important;
  }

  .group-center-head nav{
    width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }

  .group-center-head nav button{
    min-width:0!important;
    min-height:44px!important;
    padding:0 5px!important;
  }

  .group-center-body{
    padding:10px!important;
  }

  .group-center-footer{
    padding:9px 10px calc(9px + env(safe-area-inset-bottom,0px))!important;
  }

  .group-center-footer>span{
    display:none!important;
  }

  .group-center-footer button{
    min-height:44px!important;
    flex:1!important;
  }

  .avatar-crop-stage,
  .avatar-crop-stage canvas{
    width:min(260px,calc(100vw - 70px))!important;
    height:auto!important;
    aspect-ratio:1!important;
  }

  .batch-avatar-manager>header,
  .batch-avatar-manager footer{
    padding-inline:12px!important;
  }

  .batch-avatar-list{
    padding:8px!important;
  }

  .batch-avatar-row{
    grid-template-columns:48px minmax(0,1fr) 38px!important;
    gap:8px!important;
  }

  .batch-student-picker{
    grid-column:2/4!important;
  }

  .level-up-card h2{
    font-size:30px!important;
  }

  .level-up-avatar-stage{
    width:min(175px,50vw)!important;
    height:min(175px,50vw)!important;
  }

  .level-up-group-grid{
    gap:12px!important;
    margin:18px 0 13px!important;
  }

  .level-up-group-grid>div{
    width:76px!important;
  }
}

@media (max-width:359px){
  body .dashboard-header .header-brand{
    grid-template-columns:36px minmax(58px,1fr) 48px 48px 48px!important;
    gap:2px!important;
  }

  body .dashboard-header .top-primary-tool,
  body .dashboard-header .mobile-display-tool{
    width:48px!important;
    min-width:48px!important;
    font-size:9px!important;
  }

  .dashboard-student-grid{
    grid-template-columns:1fr!important;
  }

  .dashboard-student-grid .growth-star-card{
    width:min(280px,100%)!important;
    margin-inline:auto!important;
  }

  .mobile-bottom-nav button{
    font-size:9px!important;
  }
}

@media (orientation:landscape) and (max-height:560px) and (hover:none){
  :root{
    --touch-nav-height:58px;
  }

  .mobile-bottom-nav button{
    min-height:50px!important;
    flex-direction:row!important;
    gap:5px!important;
  }

  .mobile-bottom-nav button svg,
  .mobile-bottom-nav button>b{
    width:20px!important;
    height:20px!important;
    font-size:18px!important;
  }

  .modal-panel,
  .settings-panel,
  .modal-panel.group-center-modal,
  .modal-panel.avatar-batch-modal{
    max-height:calc(100dvh - 10px)!important;
  }
}

@media (prefers-reduced-motion:reduce){
  .mobile-bottom-nav *,
  .dashboard-student-grid .growth-star-card{
    scroll-behavior:auto!important;
    transition:none!important;
  }
}

/* Online-device panel overrides the generic full-height touch modal. */
@media (max-width:1024px), (max-width:1366px) and (hover:none) and (pointer:coarse){
  .modal-panel.cloud-device-modal{
    width:min(620px,calc(100vw - 20px))!important;
    height:auto!important;
    max-width:620px!important;
    max-height:calc(100dvh - 20px)!important;
    padding:0!important;
    overflow:hidden!important;
    border-radius:23px!important;
  }
  .cloud-device-panel{max-height:calc(100dvh - 20px)!important}
  .cloud-device-list{padding:16px!important}
  .cloud-device-row{min-height:88px!important}
  .cloud-device-state button{min-width:52px!important;min-height:40px!important}
  .cloud-device-actions button{min-height:44px!important}
}

@media (max-width:620px){
  .modal-panel.cloud-device-modal{
    width:calc(100vw - 16px)!important;
    max-width:none!important;
    max-height:calc(100dvh - 16px)!important;
    border-radius:21px!important;
  }
  .cloud-device-modal>.modal-close{top:12px!important;right:12px!important;width:44px!important;height:44px!important}
  .cloud-device-panel{max-height:calc(100dvh - 16px)!important}
  .cloud-device-panel>header{padding:18px 64px 15px 17px!important}
  .cloud-device-panel>header h2{font-size:21px!important}
  .cloud-device-panel>header p{font-size:11px!important}
  .cloud-device-list{gap:9px!important;padding:12px!important}
  .cloud-device-row{min-height:80px!important;grid-template-columns:43px minmax(0,1fr) auto!important;gap:10px!important;padding:11px!important;border-radius:15px!important}
  .cloud-device-icon{width:42px!important;height:42px!important;border-radius:12px!important}
  .cloud-device-icon svg{width:23px!important;height:23px!important}
  .cloud-device-info{gap:4px!important}
  .cloud-device-info b{font-size:14px!important}
  .cloud-device-info small{font-size:10px!important}
  .cloud-device-state{max-width:58px!important;flex-direction:column!important;gap:5px!important}
  .device-status{min-height:23px!important;padding:3px 8px!important;font-size:9px!important}
  .cloud-device-state button{width:52px!important;height:34px!important;min-height:34px!important}
  .cloud-device-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px))!important}
  .cloud-device-actions button{width:100%!important;min-width:0!important;min-height:44px!important}
}

@media (max-width:350px){
  .cloud-device-row{grid-template-columns:40px minmax(0,1fr) 50px!important;gap:8px!important;padding:9px!important}
  .cloud-device-icon{width:39px!important;height:39px!important}
  .cloud-device-info b{font-size:13px!important}
  .cloud-device-info small{font-size:9px!important}
}
