/* Адаптив (планшет, телефон) из app.css. Подключается ПОСЛЕ встроенного <style> страницы:
   иначе базовые правила страницы с тем же селектором перекрывали бы медиа-правила. */
  @media (max-width:560px){
    .b15tab th,.b15tab td{padding:6px 8px;font-size:12.5px;}
  }

  @media (max-width:1080px){
    .cap .cap-l{display:none;}
    .acct button[data-short] .lg{display:none;}
    .acct button[data-short]::before{content:attr(data-short);}
  }

  @media (max-width:900px){
    .hdr .row-in{gap:12px;}
    .acct .out{display:none;}
  }

  @media (max-width:1080px){
    .cab-tiles,.cab-tiles.n3{grid-template-columns:repeat(2,minmax(0,1fr));}
    .cab-g2,.cab-g3{grid-template-columns:minmax(0,1fr);}
  }

  @media (max-width:720px){
    .land.me .lrow{display:flex;flex-direction:column;}
    .land.me .lrow .btn{width:100%;max-width:none;}
    .land.me h1{font-size:30px;}
    .hwstrip{max-width:none;}
    .cab{gap:20px;}
    .cab .back{margin-bottom:-8px;}
    .cab-head .h1{font-size:30px;}
    .cab-card{padding:16px;border-radius:18px;}
    .cab-tiles,.cab-g3{gap:10px;}
    .cab-auto{grid-template-columns:minmax(0,1fr);}
    .ctile{padding:14px;}
    .ctile .v{font-size:24px;}
    .ctbl .hm{display:none;}
    .acc4,.pwf{grid-template-columns:minmax(0,1fr);}
    .acct .who{padding:0;border:0;background:transparent;}
    .acct .who.on .av{box-shadow:0 0 0 2px var(--primary);}
    .kids{display:flex;gap:8px;}
    .kids button{flex:1;min-width:0;height:54px;border-radius:14px;border:1.5px solid var(--tile-line);background:#fff;
      font:inherit;color:var(--ink);display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1.2;cursor:pointer;}
    .kids b{font-size:14.5px;}
    .kids span{font-size:12px;font-weight:700;color:var(--muted);}
    .kids button[aria-pressed="true"]{background:var(--primary);border-color:var(--primary);color:#fff;}
    .kids button[aria-pressed="true"] span{color:#dbe6ff;}
  }

  @media (max-width:1080px){
    .logo .tg{display:none;}
    .acct .who .nm{display:none;}
    .posgrid{grid-template-columns:repeat(3,minmax(0,1fr));}
    .posgrid.ex{grid-template-columns:repeat(4,minmax(0,1fr));}
    .tlay{grid-template-columns:minmax(0,1fr) 330px;}

    .land{gap:40px;}
    .land h1{font-size:44px;}
    .acc-g{grid-template-columns:repeat(2,minmax(0,1fr));}
  }

  @media (max-width:900px){
    .row-in{padding:0 24px;}
    .wrap{padding:28px 24px 60px;}
    .acct button[data-short] .lg{display:none;}
    .acct button[data-short]::before{content:attr(data-short);}
    .tlay,.tlay.th{grid-template-columns:minmax(0,1fr);}
    .side{position:static;}

    .land{grid-template-columns:minmax(0,1fr);}
    .demo .deco{display:none;}
    .acc-b{padding:20px;}
    .vrt{grid-template-columns:minmax(0,1fr);}
    .hhwc{grid-template-columns:48px minmax(0,1fr) 150px 20px;}
    .phead{flex-wrap:wrap;}
  }

  @media (max-width:720px){
    .row-in{padding:0 16px;}
    .wrap{padding:16px 16px 36px;}
    .sitefoot{margin-top:-20px;padding:0 16px 96px;}
    /* шапка */
    .hdr .row-in{height:64px;display:flex;justify-content:space-between;gap:10px;}
    .logo{gap:10px;}
    .logo svg{width:36px;height:36px;}
    .logo .wm{font-size:19px;}
    .cap{display:none;}
    .acct{gap:8px;}
    .acct .hwb{padding:0 10px 0 12px;font-size:14px;gap:6px;}
    .acct .adm{padding:0 12px;font-size:14px;}
    .acct .bdg{min-width:20px;height:20px;font-size:11.5px;padding:0 5px;}
    .acct .who .av{width:44px;height:44px;font-size:15px;}
    .acct .out{display:none;}
    .acct .pri{padding:0 18px;}
    .acct .pri svg{display:none;}
    /* вкладки — «пилюли» с прокруткой */
    .stabs{background:transparent;border:0;}
    .stabs .row-in{height:auto;padding:12px 16px 4px;gap:8px;}
    .stab{height:40px;padding:0 14px;border:1.5px solid var(--tile-line);border-radius:999px;background:#fff;font-size:14px;}
    .stab.on{background:var(--primary);border-color:var(--primary);color:#fff;}
    .stab.exam{background:#f2fcf8;border-color:#bff0df;}
    .stab.exam.on{background:var(--accent);border-color:var(--accent);color:#fff;}
    .stab.soon{background:transparent;border-style:dashed;border-color:#d5d9e8;}
    .stab .pg,.stab .lg{display:none;}
    .stab .sh{display:inline;}
    /* нижние панели: класс / «задача N из 50» */
    .cbar,.tbar{position:fixed;left:0;right:0;bottom:0;z-index:60;background:#fff;border-top:1px solid var(--line);
      box-shadow:0 -6px 18px rgba(27,31,59,.06);padding:10px 16px calc(16px + env(safe-area-inset-bottom,0px));gap:8px;}
    .cbar{display:grid;grid-template-columns:repeat(var(--n,3),minmax(0,1fr));}
    .tbar{display:grid;grid-template-columns:56px minmax(0,1fr) 56px;gap:10px;align-items:center;}
    .cbar.off,.tbar.off{display:none;}
    .cbar button{height:54px;border:0;border-radius:14px;background:var(--panel);color:var(--sel-ink);font:inherit;
      display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer;}
    .cbar button b{font-size:19px;font-weight:800;line-height:1.1;}
    .cbar button span{font-size:11.5px;font-weight:700;}
    .cbar button[aria-pressed="true"]{background:var(--primary);color:#fff;}
    .tbar button{height:52px;border-radius:14px;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0;}
    .tbar .pv{border:1.5px solid var(--panel-line);background:#fff;color:var(--sel-ink);}
    .tbar .nx{border:0;background:var(--primary);color:#fff;}
    .tbar button:disabled{opacity:.4;cursor:default;}
    .tbar .mid{text-align:center;display:flex;flex-direction:column;min-width:0;}
    .tbar .mid b{font-size:15px;font-weight:800;}
    .tbar .mid span{font-size:12px;font-weight:700;color:var(--muted);}
    /* «задача N из 50» — кнопка перехода по номеру, в режиме перехода — поле */
    .tbar button.mid{border:0;background:var(--panel);color:var(--ink);font:inherit;gap:1px;}
    .tbar button.mid:active{background:var(--sel);}
    .tbar button.mid:disabled{opacity:1;background:none;}
    .tbar .mid b{display:inline-flex;align-items:center;justify-content:center;gap:6px;}
    .tbar .mid .fi{flex:none;color:var(--sel-ink);}
    .tbar input.tj{height:52px;width:100%;min-width:0;padding:0 10px;border:1.5px solid var(--primary);border-radius:14px;
      background:#fff;box-shadow:0 0 0 4px rgba(47,107,255,.15);outline:none;text-align:center;
      font:inherit;font-size:18px;font-weight:800;color:var(--ink);}
    .tbar input.tj::placeholder{font-size:15px;font-weight:700;color:var(--muted);}
    .tbar input.tj.err{border-color:var(--wrong-bar);box-shadow:0 0 0 4px rgba(229,72,77,.15);animation:tj-shake .3s;}
    @keyframes tj-shake{25%{transform:translateX(-6px);}75%{transform:translateX(6px);}}
    body.has-bar{padding-bottom:84px;}
    /* на странице задачи вкладки разделов не нужны: выход — «Все темы» */
    body.on-task .stabs{display:none;}
    /* заголовки страниц */
    .eyebrow{font-size:13px;}
    .h1{font-size:28px;letter-spacing:-.6px;}
    .lead{font-size:14px;}
    .phead{flex-direction:column;align-items:stretch;gap:14px;margin-bottom:18px;}
    .statc{width:auto;padding:14px;border-radius:14px;}
    .statc .lg{display:none;}
    .seg{align-self:flex-start;}
    /* список тем — строками */
    .pgroup{font-size:14px;margin:0 0 8px;}
    .pgroup small{display:none;}
    .posgrid{grid-template-columns:minmax(0,1fr);gap:8px;margin-bottom:16px;}
    .ptile{display:grid;grid-template-columns:32px minmax(0,1fr);column-gap:12px;row-gap:6px;align-items:center;
      padding:12px;min-height:64px;border-radius:14px;}
    .ptile:hover{transform:none;}
    .ptile .ph{display:contents;}
    .ptile .pnum{grid-row:1 / span 2;width:32px;height:32px;border-radius:9px;font-size:13.5px;}
    .ptile .plabel{grid-column:2;font-size:14px;line-height:1.3;}
    .ptile .pf{grid-column:2;margin-top:0;max-width:220px;gap:8px;}
    .ptile .pprog{font-size:12px;}
    .ptile .here{display:none;}
    .stairs{gap:2px;}
    .stairs i:nth-child(1){height:4px;} .stairs i:nth-child(2){height:6px;} .stairs i:nth-child(3){height:8px;}
    .stairs i:nth-child(4){height:10px;} .stairs i:nth-child(5){height:12px;}
    .posgrid.ex{grid-template-columns:repeat(2,minmax(0,1fr));}
    .ptile.ex{display:flex;flex-direction:column;align-items:flex-start;min-height:112px;padding:12px 14px;gap:4px;}
    .ptile.ex .pnum{font-size:28px;width:auto;height:auto;}
    .ptile.ex .plabel{font-size:13.5px;}
    /* задача — без рамки карточки, на всю ширину */
    .tcard{background:transparent;border:0;box-shadow:none;padding:0;border-radius:0;}
    .ttop{margin-bottom:12px;}
    .ttop .arrow{display:none;}
    .ttl{font-size:21px;line-height:1.25;}
    .tsub{margin:8px 0 16px;font-size:13px;}
    .tsub .tp{display:none;}
    .qtext{font-size:17px;}
    .side{gap:10px;margin-top:20px;}
    .spanel{background:transparent;border:0;padding:0;border-radius:0;gap:8px;}
    .spanel .shd,.spanel .legend{display:none;}
    .blk:not(.cur){display:none;}
    .blks.plain .bh{display:flex;}
    .blk .bh{font-size:13px;color:var(--ink);}
    .blk .bh .bn{display:none;}
    .blk .bh .bs{display:inline;}
    .blk .grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;}
    .tile{height:44px;border-radius:10px;font-size:13.5px;}
    /* разбор темы: формулы выверены под 290 px, поля карточки их не съедают */
    .theory-card{padding:0;background:transparent;border:0;box-shadow:none;border-radius:0;}
    .theory-card .ttl{font-size:24px;}
    .theory-body{font-size:15.5px;}
    .theory-body h3{font-size:18px;}
    .theory-body .tex{padding:12px 10px;}
    .theory-body .tnote{padding:12px 12px 12px 40px;font-size:15px;}
    .theory-body .tnote::before{left:12px;top:14px;}
    .tlay.th .side{display:none;}
    /* главная */
    .home-top{margin:0 0 16px;gap:2px;}
    .home-top .h1{font-size:28px;}
    .home-top .lead{font-size:14px;}

    .hsect{margin-bottom:22px;gap:10px;}
    .hh2{font-size:19px;}

    .hvarnote{font-size:13.5px;margin:0;}
    .hvars{grid-template-columns:minmax(0,1fr);gap:10px;}
    .hvar{flex-direction:column;align-items:stretch;padding:14px;border-radius:16px;gap:10px;}
    .hvar .t > b{font-size:15px;}
    .hvar .t > span{font-size:12.5px;}
    .hvar .hvact .btn{flex:1;height:46px;}
    /* гость */
    .land{padding:4px 0 18px;gap:0;}
    .land .lt{gap:12px;}
    .land h1{font-size:30px;letter-spacing:-.7px;line-height:1.12;}
    .land .lp{font-size:15px;}
    .land .lp .more,.land .lrow,.demo{display:none;}
    .start{gap:12px;padding:0 0 10px;}
    .start h2{font-size:22px;}
    .start .lead{display:none;}
    .accs{gap:10px;}
    .acc{border-radius:18px;}
    .acc-h{gap:14px;padding:10px 12px 10px 18px;}
    .acc-h .an{width:auto;min-width:56px;font-size:44px;letter-spacing:-1.5px;}
    .acc-h .at b{font-size:17px;}
    .acc-h .at span{font-size:12.5px;}
    .acc-h .at .lg{display:none;}
    .acc-h .at .sh{display:block;}
    .acc-h .ac{display:none;}
    .acc-h .ao{width:40px;height:40px;}
    .acc-b{padding:12px;gap:12px;}
    .acc-g{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
    .acc-g button{min-height:0;padding:12px;border-radius:12px;}
    .acc-g button:hover{transform:none;}
    .acc-g b{font-size:14.5px;}
    .acc-g span{font-size:12.5px;}
    .acc-g .lg{display:none;}
    .acc-g .sh{display:block;}
    .acc-f span{display:none;}
    .acc-f .btn{flex:1;height:48px;}
    /* ДЗ */
    .hwp .home-top{margin-bottom:12px;}
    .hwp .h2{font-size:16px;margin:6px 0 10px;}
    .hwp .lead .more{display:none;}
    .hhw{gap:10px;margin-bottom:16px;}
    .hhwc{grid-template-columns:40px minmax(0,1fr);grid-template-areas:"ic t" "pr pr";gap:10px 12px;padding:14px;border-radius:16px;}
    .hhwc:hover{transform:none;}
    .hhwc .ic{grid-area:ic;width:40px;height:40px;}
    .hhwc .ic svg{width:20px;height:20px;}
    .hhwc .t{grid-area:t;gap:3px;}
    .hhwc .t b{font-size:14.5px;}
    .hhwc .t .m,.hhwc .t .d{font-size:12.5px;}
    .hhwc .pr{grid-area:pr;flex-direction:row;align-items:center;gap:10px;}
    .hhwc .pbar2{flex:1;height:6px;}
    .hhwc .pc{font-size:12.5px;white-space:nowrap;}
    .hhwc .chev{display:none;}
    /* вариант */
    #varbar .row-in{height:56px;gap:12px;}
    #varbar .vb-name,#varbar .vb-done{display:none;}
    #varbar .vb-time{font-size:18px;}
    #varbar .vb-go{height:40px;padding:0 14px;font-size:14px;}
    .vhead-r{text-align:left;}
    .res .h1{font-size:26px;}
    .vres{grid-template-columns:minmax(0,1fr);gap:10px;}
    .vres-b{padding:16px 18px;}
    .vres-n{font-size:48px;}
    .vr-row{grid-template-columns:52px minmax(0,1fr) 40px 84px;gap:8px;}
    .vr-topic{font-size:13px;}
    .vr-pt{font-size:13px;}
    .vr-st{font-size:11.5px;padding:3px 8px;}
    .card{padding:20px 18px;border-radius:18px;}
    /* окна — снизу листом */
    .mask{align-items:flex-end;padding:0;}
    .modal{max-width:none;border-radius:24px 24px 0 0;padding:12px 20px calc(22px + env(safe-area-inset-bottom,0px));
      gap:14px;max-height:92vh;}
    .modal .grab{display:block;align-self:center;width:44px;height:5px;border-radius:3px;background:#d5d9e8;flex:none;}
    .modal .mlogo{display:none;}
    .modal h3{font-size:24px;}
  }

  /* ================== СПРАВОЧНИК: окно на весь экран ================== */
  @media (max-width:640px){
    .ttop{flex-wrap:wrap;row-gap:8px;}
    .refbtn,.thybtn{height:38px;padding:0 12px;font-size:13.5px;}
    .rmask{padding:0;align-items:stretch;}
    .rdlg{max-width:none;max-height:none;height:100%;border-radius:0;}
    .rhead{padding:14px 16px 0;}
    .rtitle h3{font-size:19px;}
    .rbody{padding:4px 16px 16px;}
    .ritem.fit .fx{font-size:14px;}   /* длинная формула в одну строку на самом узком телефоне */
    .rgrid{grid-template-columns:minmax(0,1fr);}
    .rfig{grid-template-columns:130px minmax(0,1fr);}
    .rfig.stk,.rfig.big{grid-template-columns:minmax(0,1fr);justify-items:center;}
    .rfig.stk .fx,.rfig.big .fx{justify-self:stretch;}
    .rfig.big > svg{max-width:260px;}
    .rfoot{display:block;flex:none;padding:10px 16px calc(10px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--panel-line);background:#fff;}
    /* у экзаменационного задания две кнопки — «Теория» и «Справочник» — стоят вторым рядом слева */
    .ttx .lnk{flex:1 0 100%;}
    .ttx .sp{display:none;}
    .ttx .thybtn,.ttx .thybtn + .refbtn{margin-left:0;}
    .rth .theory-body{font-size:15px;}
    .rth .theory-body .tex{padding:12px 10px;}
    .rth .theory-body .tnote{padding:12px 12px 12px 40px;font-size:15px;}
    .rth .theory-body .tnote::before{left:12px;top:14px;}
    .rth .thh{font-size:18px;}
    .thcard{padding:11px 12px;}
    .rfoot button{width:100%;height:50px;border:0;border-radius:12px;background:var(--primary);color:#fff;font:inherit;font-size:15px;font-weight:800;cursor:pointer;}
  }

  /* ================== ПЕЧАТНЫЙ ВАРИАНТ: составитель на телефоне ================== */
  @media (max-width:640px){
    .pdf-open{margin-left:0;align-self:stretch;justify-content:center;height:44px;}
    .pdf-dlg{max-width:none;}
    .pdf-body{padding:10px 16px 14px;}
    .pdf-seg{display:flex;margin:10px 0 12px;}
    .pdf-seg button{flex:1;padding:0 8px;}
    .pdf-r .pdf-l{grid-template-columns:auto 40px minmax(0,1fr);}
    .pdf-r .md{grid-column:2 / -1;}
    .pdf-r .md button{flex:1;max-width:none;}
    .pdf-p{padding-left:14px;}
    .pdf-p .tl label{grid-template-columns:auto 38px minmax(0,1fr);}
    .pdf-p .tl .an{grid-column:3;}
    .pdf-sum>div{grid-template-columns:40px minmax(0,1fr) 30px;}
    .pdf-sum .mt{grid-column:2;}
    .pdf-sum .ct{grid-column:2;grid-row:2;}
    .pdf-sum .again{grid-column:3;grid-row:1 / span 2;align-self:center;}
    .pdf-foot{padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));gap:8px;}
    .pdf-num{flex:1 1 100%;justify-content:space-between;}
    .pdf-go .btn{flex:1 1 100%;height:50px;}
    .pdf-hint{flex:1 1 100%;}
  }
