/* phone-nav: нижняя панель для телефонов (html.phone), стеклянная, iOS-стиль. 23.10.2026 */
html.phone{-webkit-tap-highlight-color:transparent}
html.phone body{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,"Segoe UI",Roboto,sans-serif}
html.phone .shell .rail{background:rgba(20,16,13,.72)!important;-webkit-backdrop-filter:blur(20px) saturate(1.8);backdrop-filter:blur(20px) saturate(1.8);border-top:.5px solid rgba(255,255,255,.12)!important;z-index:50}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){html.phone .shell .rail{background:var(--sidebar,#141010)!important}}
html.mux-light.phone .shell .rail,html.phone.light .shell .rail{background:rgba(250,248,246,.78)!important;border-top-color:rgba(0,0,0,.12)!important}
html.phone .shell .rail .rail-item.pn-x{display:none!important}
html.phone .shell .rail .rail-item{min-height:50px;transition:transform .15s ease,opacity .2s;opacity:.62}
html.phone .shell .rail .rail-item.on{opacity:1;color:var(--accent,#ff8a2a)!important}
html.phone .shell .rail .rail-item.on svg [stroke]{stroke-width:2.2}
html.phone .shell .rail .rail-item:active{transform:scale(.96)}
html.phone .shell .rail #pn-more{order:10}
html.phone .shell .rail #menu-btn{order:11!important}
/* скрыть панель в открытом чате и при клавиатуре */
@media (max-width:860px){html.phone.pn-kb .shell .rail,html.phone.pn-chat .shell .rail{display:none!important}} /* LANDFIX 26.11: только в мобильной раскладке */
/* настройки: видимая кнопка «‹ Назад» с учётом выреза */
html.phone #menu-back{display:grid!important;place-items:center;position:absolute;top:calc(6px + env(safe-area-inset-top));left:8px;width:44px;height:44px;border-radius:50%;background:rgba(255,255,255,.08);color:var(--text);z-index:5}
html.phone .menu-hero{position:relative}
html.phone .menu-hero .menu-title{padding-left:48px;box-sizing:border-box}
/* сгруппированные списки в стиле iOS */
html.phone .menu-list{border-radius:12px!important;overflow:hidden;padding:0!important}
html.phone .menu-list>*{min-height:44px;border-bottom:.5px solid var(--line,rgba(255,255,255,.08))!important}
html.phone .menu-list>*:last-child{border-bottom:0!important}
/* листы и переходы */
@keyframes pn-in{from{transform:translateX(28px);opacity:0}to{transform:none;opacity:1}}
@keyframes pn-up{from{transform:translateY(100%)}to{transform:none}}
html.phone .sidebar>.pane:not([hidden]){animation:pn-in .28s cubic-bezier(.32,.72,0,1)}
#pn-sheet{position:fixed;inset:0;z-index:9700;background:rgba(0,0,0,.4);display:flex;align-items:flex-end}
#pn-sheet[hidden]{display:none}
#pn-sheet .pn-card{width:100%;padding:8px 12px calc(14px + env(safe-area-inset-bottom));border-radius:16px 16px 0 0;background:rgba(28,22,18,.92);-webkit-backdrop-filter:blur(24px) saturate(1.8);backdrop-filter:blur(24px) saturate(1.8);color:#f3ebe4;animation:pn-up .3s cubic-bezier(.32,.72,0,1)}
html.mux-light #pn-sheet .pn-card{background:rgba(250,248,246,.95);color:#1b1410}
#pn-sheet .pn-grab{width:36px;height:5px;border-radius:3px;background:rgba(127,127,127,.5);margin:2px auto 10px}
#pn-sheet .pn-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
#pn-sheet button{display:flex;flex-direction:column;align-items:center;gap:6px;min-height:72px;padding:10px 2px;border:0;border-radius:14px;background:rgba(127,127,127,.12);color:inherit;font:500 12px/1.2 -apple-system,system-ui,sans-serif;transition:transform .15s}
#pn-sheet button:active{transform:scale(.96)}
#pn-sheet svg{width:24px;height:24px}
@media (prefers-reduced-motion:reduce){html.phone *,#pn-sheet *{animation:none!important;transition:none!important}}
/* LANDFIX 26.11.2026: телефонная раскладка — только до 860px, как мобильная вёрстка app.css.
   Иначе в альбомной ориентации iPhone Plus / 16 Pro / Pro Max (874–956px) телефонные правила смешивались с десктопной сеткой:
   панель вкладок уезжала наверх, список чатов получал нулевую высоту. */
@media (max-width:860px){
/* полноэкранный режим на телефонах: фон до краёв, без белых полос */
html.phone,html.phone body{margin:0;height:100%;min-height:100dvh;background:var(--bg,#0d0a08);overscroll-behavior:none}
@supports (-webkit-touch-callout:none){html.phone body{min-height:-webkit-fill-available}}
html.phone .shell{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);box-sizing:border-box}
html.phone .m-head,html.phone .pane-head{padding-top:max(env(safe-area-inset-top),8px)!important}
/* «Настройки» — всегда вкладка в нижней панели на телефонах */
html.phone .shell .rail .rail-items>#menu-btn{display:flex!important;visibility:visible!important}
html.phone .shell .rail .rail-item .rail-label{display:block!important}
html.phone.rd .rd-me{display:none!important}

/* 23.10 v2: панель прижата к самому низу, без пустой полосы под ней */
html.phone:not(.pn-kb) .shell{position:fixed!important;top:0!important;left:0;right:0;bottom:0!important;height:auto!important;max-height:none!important;min-height:0!important;margin:0!important}
html.phone .shell .rail{margin:0!important;bottom:0;padding-top:2px!important;padding-bottom:max(calc(env(safe-area-inset-bottom) - 14px),6px)!important}
html.phone .shell .rail .rail-item{min-height:46px!important;padding:3px 0 1px!important}
html.phone body,html.phone #app{padding-bottom:0!important;margin-bottom:0!important}
/* 23.10 v3: ещё ниже — подписи сразу над полоской «Домой» */
html.phone body .shell nav.rail{margin:0!important;padding-top:1px!important;padding-bottom:max(calc(env(safe-area-inset-bottom) - 26px),2px)!important} /* IOSGAP: иконки вплотную к полоске «домой» */
html.phone body .shell nav.rail .rail-item{min-height:44px!important;padding:2px 0 0!important;gap:1px!important}
html.phone:not(.pn-kb) body #app.shell{position:fixed!important;inset:0!important;top:0!important;bottom:0!important;height:auto!important;max-height:none!important;padding-bottom:0!important;margin:0!important;transform:none!important}
html.phone,html.phone body{padding-bottom:0!important;margin-bottom:0!important}
/* v4 (23.10): одна аккуратная точка LIVE на вкладке «Стримы», без оранжевого пятна */
html.phone .shell .rail .stv-nav .stv-nav-ico{color:inherit!important}
html.phone .shell .rail .stv-nav .rail-label{color:inherit!important}
html.phone .shell .rail .stv-nav .stv-nav-ico .stv-dot{top:-1px!important;right:-3px!important;width:8px!important;height:8px!important;border:0!important;box-shadow:0 0 0 1.5px rgba(20,16,13,.9)!important;background:#ff3b30!important;animation:none!important}
/* 44px для мелких кнопок закрытия на телефонах */
html.phone .icon-btn,html.phone [id$="-close"],html.phone [id$="-back"]{min-width:44px;min-height:44px}
#pn-fab-back{position:fixed;z-index:2147480000;top:calc(6px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));width:44px;height:44px;border:0;border-radius:50%;display:grid;place-items:center;color:#fff;background:rgba(20,16,13,.55);-webkit-backdrop-filter:blur(16px) saturate(1.6);backdrop-filter:blur(16px) saturate(1.6);box-shadow:0 2px 10px rgba(0,0,0,.3);transition:transform .15s}
#pn-fab-back[hidden]{display:none}
#pn-fab-back:active{transform:scale(.94)}

/* v5 (23.10): «Видео» — кнопка × всегда видна на телефоне (поиск сжимается) */
html.phone #vd-view .vd-search{flex:1 1 0!important;min-width:0!important;width:auto!important}
html.phone #vd-view .vd-search input{min-width:0!important;width:100%!important}
html.phone #vd-view .vd-brand b{display:none}
html.phone #vd-view [data-vd=close]{flex:none!important;display:grid!important;place-items:center;min-width:44px;min-height:44px}

/* v5: слой кошелька/AI-студии — кнопка «Назад» 44px, низ не под полоской «Домой» */
html.phone #iskra-layer{padding-bottom:env(safe-area-inset-bottom)}
html.phone #iskra-layer>div>button{min-height:44px;min-width:44px}
/* ========== v6 (25.10.2026): скролл панелей на телефоне / iOS ==========
   Причина: shell height:auto+inset ломал flex/grid цепочку на iOS —
   панели росли по контенту, overflow-y:auto не срабатывал, а окно fixed. */
html.phone:not(.pn-kb) body #app.shell{
  position:fixed!important;
  top:0!important;left:0!important;right:0!important;bottom:0!important;
  height:100dvh!important;max-height:100dvh!important;min-height:0!important;
  overflow:hidden!important;margin:0!important;padding-bottom:0!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:minmax(0,1fr) auto!important;
}
/* IOSGAP 26.11.2026: -webkit-fill-available на iPhone (особенно «на экране Домой») не включает зону под полоской «домой» —
   снизу оставалась серая полоса ~0,5 см. Теперь он только для старых iOS без dvh; на iOS 15.4+ — реальная видимая высота. */
@supports (-webkit-touch-callout:none) and (not (height:100dvh)){
  html.phone:not(.pn-kb) body #app.shell{
    height:-webkit-fill-available!important;
    max-height:-webkit-fill-available!important;
  }
}
@supports (-webkit-touch-callout:none) and (height:100dvh){
  html.phone:not(.pn-kb) body #app.shell{
    height:var(--app-height,100dvh)!important;
    max-height:none!important;
  }
}
html.phone .shell > .sidebar{
  grid-row:1;min-height:0!important;height:auto!important;max-height:100%!important;
  overflow:hidden!important;display:flex!important;flex-direction:column!important;
  align-self:stretch;
}
html.phone .shell > .sidebar > .pane:not([hidden]){
  flex:1 1 0!important;min-height:0!important;max-height:none!important;
  overflow:hidden!important;display:flex!important;flex-direction:column!important;
  -webkit-overflow-scrolling:touch;
}
/* Настройки: скроллит вся панель (hero + список) */
html.phone #menu-pane{
  overflow-x:hidden!important;overflow-y:auto!important;
  -webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding-bottom:calc(72px + env(safe-area-inset-bottom))!important;
}
/* Скругление списка без overflow:hidden — иначе iOS иногда глотает жест */
html.phone .menu-list{
  overflow:visible!important;
  isolation:isolate;
  background-clip:padding-box;
}
html.phone .menu-list>*{border-radius:0}
html.phone .menu-list>:first-child{border-top-left-radius:12px;border-top-right-radius:12px}
html.phone .menu-list>:last-child{border-bottom-left-radius:12px;border-bottom-right-radius:12px;border-bottom:0!important}
/* Профиль / пароль / уведомления: шапка фиксирована, тело скроллит */
html.phone #edit-pane .edit-head,
html.phone #security-pane .edit-head,
html.phone #notify-pane .edit-head{flex:none}
html.phone #edit-pane .edit-body,
html.phone #security-pane .edit-body,
html.phone #notify-pane .edit-body{
  flex:1 1 0!important;min-height:0!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  -webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding-bottom:calc(28px + 72px + env(safe-area-inset-bottom))!important;
}
/* Чаты / контакты / звонки */
html.phone #chats-pane .chats,
html.phone #chats-pane .people,
html.phone #contacts-pane #ct-list,
html.phone #calls-pane #cl-list{
  flex:1 1 0!important;min-height:0!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  -webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding-bottom:calc(20px + 72px + env(safe-area-inset-bottom))!important;
}
html.phone #chats-pane > .m-head,
html.phone #chats-pane > .side-head,
html.phone #chats-pane > .list-tabs,
html.phone #chats-pane > .m-pins,
html.phone #contacts-pane > .m-head,
html.phone #contacts-pane > .ct-search,
html.phone #calls-pane > .m-head,
html.phone #calls-pane > .cl-tabs{flex:none}
/* Профиль справа / оверлей */
/* v7 (25.10): .profile только когда НЕ hidden — иначе перекрывает Настройки (зависание) */
html.phone .profile:not([hidden]){
  display:flex!important;flex-direction:column!important;
  min-height:0!important;overflow:hidden!important;
  height:100dvh!important;max-height:100dvh!important;
  top:0!important;bottom:auto!important;
}
html.phone .profile[hidden]{display:none!important}
html.phone .profile-scroll{
  flex:1 1 0!important;min-height:0!important;
  overflow-y:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding-bottom:calc(28px + env(safe-area-inset-bottom))!important;
}
/* Файлы */
html.phone .files-view:not([hidden]){
  display:flex!important;flex-direction:column!important;
  min-height:0!important;overflow:hidden!important;height:100%!important;
}
html.phone .fv-body{
  flex:1 1 0!important;min-height:0!important;
  overflow-y:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding-bottom:calc(24px + 72px + env(safe-area-inset-bottom))!important;
}
/* Кошелёк / AI слой */
html.phone #iskra-layer{
  overflow-y:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding-bottom:calc(24px + env(safe-area-inset-bottom))!important;
}
/* Лайтбокс фото: safe-area + кнопка 44px, низ не под Home Indicator */
html.phone .lightbox:not([hidden]){
  padding:calc(48px + env(safe-area-inset-top)) 16px calc(72px + env(safe-area-inset-bottom))!important;
  height:100dvh!important;max-height:100dvh!important;top:0!important;bottom:auto!important;
  box-sizing:border-box;
}
html.phone .lightbox #lightbox-close{
  top:calc(8px + env(safe-area-inset-top))!important;
  right:calc(8px + env(safe-area-inset-right))!important;
  width:44px!important;height:44px!important;min-width:44px;min-height:44px;
  display:grid!important;place-items:center;
  background:rgba(20,16,13,.55);border-radius:50%;
  -webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);
}
html.phone .lightbox .lightbox-dl,
html.phone .lightbox #lightbox-dl{
  bottom:calc(16px + env(safe-area-inset-bottom))!important;
  min-height:44px;display:inline-flex;align-items:center;
}
/* Стримы: закрытие 44px + низ */
html.phone .stv-head [data-stv=close],
html.phone .stv-head .stv-close,
html.phone .stv [data-stv="close"]{
  min-width:44px!important;min-height:44px!important;
}
html.phone .stv-compose,
html.phone .stv-side{
  padding-bottom:max(10px,env(safe-area-inset-bottom))!important;
}
/* Видео: уже есть safe-area; усилим крестик */
html.phone #vd-view [data-vd=close],
html.phone .vd-top [data-vd=close]{
  min-width:44px!important;min-height:44px!important;
}
/* Музыка: полноэкран / big host под safe-area */
html.phone .mp-host.big{
  padding-top:env(safe-area-inset-top);
  padding-bottom:env(safe-area-inset-bottom);
  box-sizing:border-box;
}
html.phone .mp-host.big .mp-vbox{max-height:100%;}
html.phone .mp-bar{
  bottom:calc(8px + env(safe-area-inset-bottom));
}
html.phone .mx-now,
html.phone [class*="mx-now"]{
  padding-bottom:env(safe-area-inset-bottom);
}

/* streams/video/music close + safe-area polish */
html.phone .stv-closeb,
html.phone .stv [data-st="close"],
html.phone .stv-head .stv-ib{
  min-width:44px!important;min-height:44px!important;
}
html.phone .stv-compose{padding-bottom:max(12px,env(safe-area-inset-bottom))!important}
html.phone .stv-side{padding-bottom:max(10px,env(safe-area-inset-bottom))!important}
html.phone #vd-view [data-vd=close],html.phone .vd-top [data-vd=close]{min-width:44px!important;min-height:44px!important}
html.phone .mp-host.big{padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);box-sizing:border-box}
html.phone .mp-host.big .mp-vbox{max-height:100%}
html.phone .mp-top{padding-top:max(8px,env(safe-area-inset-top))!important}
html.phone .mx-now{padding-top:env(safe-area-inset-top)!important;padding-bottom:env(safe-area-inset-bottom)!important;box-sizing:border-box}
html.phone .mx-now .mx-x,html.phone .mx-now-x button,html.phone .mx-now .mx-now-x .mp-ib{min-width:44px!important;min-height:44px!important}
html.phone .mp-main{padding-bottom:calc(16px + env(safe-area-inset-bottom))!important;-webkit-overflow-scrolling:touch}

html.phone .lightbox[hidden]{display:none!important}

/* ========== v8 (25.10.2026): чат/диалоги iPhone — не «как с клавиатурой» ==========
   1) pn-kb только при реальной клавиатуре (см. phone-nav.js) — fullscreen :not(.pn-kb) остаётся.
   2) sidebar больше не форсится display:flex поверх chat-open (иначе stage/тред делят экран).
   3) при реальной kb — shell явно по visualViewport. */
html.phone body #app.shell.chat-open > .sidebar,
html.phone.pn-chat body #app.shell > .sidebar{
  display:none!important;
}
html.phone.pn-chat:not(.pn-kb) body #app.shell,
html.phone body #app.shell.chat-open:not(.pn-kb){
  grid-template-rows:minmax(0,1fr)!important;
}
html.phone body #app.shell.chat-open > .stage,
html.phone.pn-chat body #app.shell > .stage{
  display:grid!important;
  grid-row:1!important;
  height:100%!important;
  min-height:0!important;
  max-height:none!important;
}
html.phone.pn-chat .thread,
html.phone body #app.shell.chat-open .thread{
  height:100%!important;
  min-height:0!important;
  max-height:none!important;
}
html.phone.pn-kb body #app.shell{
  position:fixed!important;
  left:0!important;right:0!important;
  top:var(--vv-top,0px)!important;
  bottom:auto!important;
  height:var(--app-height,100dvh)!important;
  max-height:var(--app-height,100dvh)!important;
  min-height:0!important;
  margin:0!important;
  overflow:hidden!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:minmax(0,1fr)!important;
}

/* ========== v9 (25.10.2026): Игры/Музыка на телефоне — не наезжают на чаты ==========
   phone-nav v6 форсит sidebar display:flex!important (специфичнее, чем games.css
   .shell.games-open > .sidebar {display:none}), из‑за этого «Миниигры» и куски
   games-view торчат поверх списка чатов. */
html.phone body #app.shell.games-open > .sidebar,
html.phone body #app.shell.music-open > .sidebar{
  display:none!important;
}
html.phone body #app.shell.games-open > .stage,
html.phone body #app.shell.music-open > .stage,
html.phone body #app.shell.games-open > .profile,
html.phone body #app.shell.music-open > .profile,
html.phone body #app.shell.games-open > .files-view,
html.phone body #app.shell.music-open > .files-view{
  display:none!important;
}
html.phone body #app.shell.games-open > .music-view.games-view:not([hidden]),
html.phone body #app.shell.music-open > .music-view:not(.games-view):not([hidden]){
  grid-column:1!important;
  grid-row:1!important;
  display:flex!important;
  flex-direction:column!important;
  min-width:0!important;
  min-height:0!important;
  height:auto!important;
  max-height:100%!important;
  overflow:hidden!important;
  z-index:5;
  align-self:stretch;
}
html.phone body #app.shell.games-open > .music-view.games-view:not([hidden]) .gm-body,
html.phone body #app.shell.games-open > .music-view.games-view:not([hidden]) .gm-cardgames{
  flex:1 1 0!important;
  min-height:0!important;
  overflow-y:auto!important;
  -webkit-overflow-scrolling:touch;
  padding-bottom:calc(20px + 72px + env(safe-area-inset-bottom))!important;
}
/* MUSICNAV 26.11.2026: «Музыка» в нижней панели на месте «Стримов» (стримы — в «Ещё») */
html.phone .shell .rail #ia-music-nav:not(.pn-x){display:flex!important;order:6}
html.phone .shell .rail #ia-music-nav .ia-mn-ico{margin:0 auto}
html.phone .shell .rail #ia-music-nav .ia-mn-ico{background:none!important;box-shadow:none!important;width:24px;height:24px}
html.phone .shell .rail #ia-music-nav:not(.on) .ia-mn-ico svg{color:currentColor!important}
/* NAVNOFLASH 26.11.2026: на телефоне внизу только Чаты · Музыка · Ещё · Настройки — сразу, без перестроек.
   Кнопки, которые другие скрипты добавляют позже (Стримы, Фильмы, Видео, Игры…), скрыты с первого кадра и живут в «Ещё». */
html.phone .shell .rail .rail-items>:not([data-nav=chats]):not(#ia-music-nav):not(#pn-more):not(#menu-btn){display:none!important}
html.phone .shell .rail #ia-music-nav{display:flex!important;order:6}
html.phone .shell .rail #ia-music-nav.ia-off{opacity:.55}
} /* /LANDFIX */
