/* Планшетный режим: iPad и Android/Huawei, портрет и альбомная ориентация. */
button.rail-tablet-toggle{display:none}
@media (min-width:768px) and (max-width:1180px){
  .rail-tablet-toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;min-width:44px;height:44px;padding:0;border:1px solid var(--line);border-radius:13px;background:var(--surface);color:var(--muted);cursor:pointer}
  .rail-tablet-toggle:hover{background:var(--surface-2);color:var(--ink)}
  .rail-tablet-toggle svg{width:21px;height:21px}
  :root{--rail:68px}
  body.rail-open{--rail:68px}
  .topbar{padding:12px 16px 0}
  .topbar-in{min-height:56px;gap:10px}
  .rail,.rail-open .rail{
    display:flex;left:12px;top:88px;width:68px;max-height:calc(100dvh - 104px);
    padding:10px 7px;border-radius:18px;overscroll-behavior:contain;
  }
  .rail a,.rail button{height:46px;padding:0 12px;justify-content:center}
  .rail a svg,.rail button svg{width:21px;height:21px}
  .rail .lbl,.rail .rail-cap,.rail .ng-chev{display:none!important}
  .rail .ng-list{display:none!important}
  .rail .badge{position:absolute;top:4px;left:34px;margin:0}
  .rail-bots-row,.rail-open .rail-bots-row{flex-direction:column;align-items:center;justify-content:center;padding:2px 0}
  .rail a.rbot,.rail .rbot{width:40px;height:40px;min-width:40px}
  .rail-foot,.rail-open .rail-foot{flex-direction:column}
  .rail-foot>button.rail-tablet-toggle{display:flex}
  body.rail-open .rail{width:240px;box-shadow:0 18px 48px rgba(18,28,23,.2)}
  body.rail-open .rail a,body.rail-open .rail button{justify-content:flex-start}
  body.rail-open .rail .lbl{display:inline!important;opacity:1}
  body.rail-open .rail .ng-list{display:flex!important}
  body.rail-open .rail .rail-foot{flex-direction:row}
  body.rail-open .rail-foot>button:first-child{flex:1}
  body.rail-open .rail-bots-row{flex-direction:row;align-items:center;justify-content:flex-start}
  .main,.rail-open .main{
    margin-left:92px;max-width:none;padding:22px 22px 64px 0;
  }
  .tabbar{display:none!important}
  .nav-fly{display:flex}
  .nav-fly a{min-height:44px}
  .search{display:none}
  .me .who{display:none}
  .top-right{gap:6px}
  .bell{width:44px;height:44px}
  .page-head{gap:14px}
  .grid-dash{grid-template-columns:1fr}
  .grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
  .card{min-width:0}
  .modal-back{align-items:center;padding:32px 24px;overscroll-behavior:contain}
  .modal{border-radius:22px;max-height:calc(100dvh - 64px);overflow-y:auto}
  .modal-head{position:sticky;top:0;z-index:2;background:var(--surface)}
  .modal-foot{position:sticky;bottom:0;z-index:2;background:var(--surface)}
  .close{display:grid;place-items:center;min-width:44px;min-height:44px}
  .toast{bottom:24px}
  .demo-badge{bottom:20px}
  .set-nav{overflow-x:auto;scrollbar-width:thin;padding-bottom:4px}
  .set-nav button{min-height:44px}
  .hw-controls{grid-template-columns:minmax(0,1fr) minmax(150px,.55fr)}
  .hw-controls .search-in{grid-column:1/-1}
  .table-wrap,.th-table-wrap{overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
  body.students-page .main,body.finance-page .main,body.homework-page .main{padding-top:22px;padding-bottom:64px}
}

/* На широком планшете основные блоки снова работают в две колонки. */
@media (min-width:1000px) and (max-width:1180px){
  .search{display:block;max-width:300px;margin-left:0}
  .me .who{display:block}
  .grid-dash{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr)}
}

/* Сенсорные цели: не меньше 44 px, включая компактные кнопки и переключатели. */
@media (pointer:coarse){
  a,button,input,select,textarea,summary,label{touch-action:manipulation}
  button,a.btn,.btn,.btn.small,.btn.icon,.seg button,.tabbar a,.pill-link,
  .icon-btn,.news-btn,.theme-btn,.bd-tool,.bd-pg,.bd-zoom button{min-height:44px}
  .btn.icon,.bell,.bd-tool{width:44px;min-width:44px;height:44px}
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
  select,textarea{font-size:16px}
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not(.bd-ta),
  select{min-height:44px}
  .row,.lesson,.m-day,.pi-main,.tr-topic,.create-tile,.hw-item{min-height:44px}
  .switch::before{content:"";position:absolute;inset:-9px 0}
  .bd-col{position:relative}
  .bd-col::before{content:"";position:absolute;inset:-10px}
  .bd-wd{width:40px;height:40px}
}

/* Доска: инструменты не уменьшаются на невысоком планшете в альбомной ориентации. */
@media (min-width:761px) and (max-width:1180px) and (pointer:coarse){
  .bd-toolbar{left:max(8px,env(safe-area-inset-left));max-height:calc(100dvh - 120px);overscroll-behavior:contain}
  .bd-subbar{left:66px;max-height:calc(100dvh - 120px);overflow-y:auto}
  .bd-pg,.bd-zoom button{min-width:44px;height:44px}
  .bd-pages{bottom:calc(10px + env(safe-area-inset-bottom));max-width:calc(100vw - 150px);overflow-x:auto}
  .bd-zoom{right:max(10px,env(safe-area-inset-right));bottom:calc(10px + env(safe-area-inset-bottom))}
}

@media (prefers-reduced-motion:reduce){
  .rail,.main,.modal,.modal-back{transition:none!important;animation:none!important}
}


/* Десктоп: сворачивание меню не нужно — кнопки «Свернуть» нет, панель всегда раскрыта (JS: width>1180 → rail-open). */
@media (min-width:1181px){
  .rail-collapse{display:none!important}
}

/* v3: одна кнопка меню; раскрытая панель сдвигает контент, а не закрывает его. */
@media (min-width:768px) and (max-width:1180px){
  .rail-foot>button.rail-collapse{display:none!important}
  body.rail-open .main{margin-left:264px;padding-right:22px}
  body.rail-open .today-grid,body.rail-open .st-home-grid{grid-template-columns:minmax(0,1fr)}
  body.rail-open .today-aside{position:static}
  .top-clock .tc-date,.top-clock .tc-zone{display:none}
}
@media (min-width:768px) and (max-width:960px){
  .top-clock{display:none}
}

/* v4: карточки мессенджеров не сжимаются до нечитаемого текста. */
@media (max-width:1000px){
  .bot-grid{grid-template-columns:minmax(0,1fr)}
  .bot-card{min-width:0}
  .bot-card .grow{overflow-wrap:anywhere}
}
