/* VPN/WHEEL: встроенные приложения — левая панель (десктоп), меню слева (телефон), VPN-панель, «Колесо удачи», реклама @vpnbot */
:root { --ia-w: 72px; }
.ia-rail, .ia-expand, .ia-drawer { font-family: var(--font); }

/* ---------- десктоп: узкая панель приложений слева от основной ---------- */
.ia-rail { display: none; }
.ia-expand { display: none; }
@media (min-width: 861px) {
  body.ia-on:not(.ia-collapsed):not(.ia-empty) .shell { margin-left: var(--ia-w); width: calc(100% - var(--ia-w)); }
  body.ia-on:not(.ia-collapsed):not(.ia-empty) .ia-rail { display: flex; }
  .ia-rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--ia-w); z-index: 60;
    flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 12px;
    background: color-mix(in srgb, var(--rail) 82%, #000); border-right: 1px solid var(--line);
  }
  .ia-rail-head { display: grid; justify-items: center; gap: 2px; color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: .6px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); width: 48px; }
  .ia-rail-head svg { color: var(--accent); }
  .ia-rail-items { display: grid; gap: 6px; }
  .ia-item {
    position: relative; width: 58px; padding: 9px 2px 7px; border: 0; border-radius: 14px; background: transparent; color: #c9d3ce;
    display: grid; justify-items: center; gap: 4px; font-size: 11px; font-weight: 600; transition: background .15s, color .15s, transform .15s;
  }
  .ia-item svg { color: #aeb9b3; transition: color .15s; }
  .ia-item:hover { background: var(--hover); color: #fff; }
  .ia-item:hover svg { color: var(--accent); }
  .ia-item:active { transform: scale(.96); }
  .ia-item .ia-badge { position: absolute; top: 3px; right: 5px; }
  .ia-label { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ia-collapse { margin-top: auto; width: 34px; height: 30px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); display: grid; place-items: center; }
  .ia-collapse:hover { color: var(--text); background: var(--hover); }
  body.ia-on.ia-collapsed:not(.ia-empty) .ia-expand { display: grid; }
  .ia-expand {
    position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 60; width: 22px; height: 56px; padding: 0;
    border: 1px solid var(--line-2); border-left: 0; border-radius: 0 12px 12px 0; background: var(--panel); color: var(--accent); place-items: center;
  }
  .ia-expand svg { width: 15px; height: 15px; }
  .ia-expand .ia-dot { position: absolute; top: 6px; right: 4px; }
}
.ia-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font: 700 11px/18px var(--font); font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--rail); animation: ia-pulse 2s ease-in-out infinite; }
.ia-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--sidebar); }
@keyframes ia-pulse { 50% { transform: scale(1.12); } }

/* ---------- телефон: кнопка в шапке и меню, выезжающее слева ---------- */
.ia-menu-btn { position: relative; display: none !important; }
@media (max-width: 860px) {
  .ia-menu-btn { display: grid !important; margin-right: 2px; }
  #m-head .ia-menu-btn + .m-logo { display: none; }
}
.ia-drawer { position: fixed; inset: 0; z-index: 2050; }
.ia-drawer-back { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .2s; }
.ia-drawer-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: min(320px, 84vw); background: var(--sidebar); border-right: 1px solid var(--line-2);
  transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.3,1); display: flex; flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: 12px 0 40px rgba(0,0,0,.4);
}
.ia-drawer.open .ia-drawer-back { opacity: 1; }
.ia-drawer.open .ia-drawer-panel { transform: none; }
.ia-drawer-panel header { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 14px; font-size: 18px; }
.ia-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--panel-2); color: var(--muted); display: grid; place-items: center; }
.ia-drawer-items { display: grid; gap: 6px; }
.ia-ditem { display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; border-radius: 14px; background: var(--panel); color: var(--text); text-align: left; }
.ia-ditem:active { background: var(--selected); }
.ia-dico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.ia-dtext { display: grid; gap: 2px; flex: 1; min-width: 0; }
.ia-dtext small { color: var(--muted); font-size: 13px; }
.ia-drawer-note { color: var(--muted-2); font-size: 12.5px; margin: auto 6px 0; padding-top: 16px; }

/* ---------- верх списка чатов: реклама @vpnbot и «Колесо удачи» ---------- */
.ia-top { display: grid; gap: 8px; padding: 4px 12px 8px; }
.ia-top.ia-searching { display: none; }
.ia-ad {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 36px 11px 12px; border-radius: 16px; cursor: pointer;
  background: linear-gradient(120deg, rgba(var(--accent-rgb), .20), rgba(14,165,233,.12) 70%, rgba(124,58,237,.12));
  border: 1px solid rgba(var(--accent-rgb), .32); transition: transform .15s, border-color .15s;
}
.ia-ad:hover { border-color: rgba(var(--accent-rgb), .6); }
.ia-ad:active { transform: scale(.99); }
.ia-ad:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ia-ad-ava { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .5); }
.ia-ad-ava img { width: 100%; height: 100%; object-fit: cover; }
.ia-ad-ava span { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; }
.ia-ad-text { display: grid; gap: 3px; min-width: 0; }
.ia-ad-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ia-ad-name b { white-space: nowrap; }
.ia-ad-name small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia-ad-name em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 0 5px; line-height: 16px; margin-left: auto; text-transform: uppercase; letter-spacing: .4px; }
.ia-ad-desc { font-size: 13px; color: #d6e2dc; line-height: 1.35; }
.ia-ad-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.25); color: var(--muted); display: grid; place-items: center; }
.ia-ad-x:hover { color: #fff; background: rgba(0,0,0,.45); }
.ia-wheel {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 12px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); text-align: left; transition: border-color .15s, background .15s;
}
.ia-wheel:hover { background: var(--panel-2); }
.ia-wheel.can { border-color: rgba(245,158,11,.45); background: linear-gradient(120deg, rgba(245,158,11,.14), rgba(239,68,68,.08)); }
.ia-wheel-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #f59e0b; background: rgba(245,158,11,.14); flex: none; }
.ia-wheel.can .ia-wheel-ico svg { animation: ia-spin 6s linear infinite; }
@keyframes ia-spin { to { transform: rotate(360deg); } }
.ia-wheel-text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.ia-wheel-text small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.ia-wheel.can .ia-wheel-text small { color: #fbbf24; }
.ia-wheel-go { padding: 7px 14px; border-radius: 999px; background: #f59e0b; color: #1f1300; font-weight: 700; font-size: 13px; white-space: nowrap; }
.ia-wheel-go i { font-style: normal; background: rgba(0,0,0,.18); border-radius: 999px; padding: 0 6px; margin-left: 2px; }
.ia-wheel-more { color: var(--muted); font-size: 13px; }

/* ---------- окно «Колеса удачи» ---------- */
.ia-modal { position: fixed; inset: 0; z-index: 2150; display: grid; place-items: center; padding: 16px; background: rgba(3,6,5,.72); opacity: 0; transition: opacity .2s; }
.ia-modal.open { opacity: 1; }
.ia-modal-card {
  position: relative; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px 18px 18px; border-radius: 22px;
  background: radial-gradient(120% 60% at 50% 0%, rgba(245,158,11,.14), transparent 60%), var(--sidebar); border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px rgba(0,0,0,.55); transform: translateY(14px) scale(.97); transition: transform .25s cubic-bezier(.2,.9,.3,1.2);
}
.ia-modal.open .ia-modal-card { transform: none; }
.ia-modal-card h2 { margin: 0; text-align: center; font-size: 20px; }
.ia-modal-sub { margin: 6px 0 14px; text-align: center; color: var(--muted); font-size: 13.5px; }
.ia-modal-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--panel-2); color: var(--muted); display: grid; place-items: center; z-index: 2; }
.ia-modal-x:hover { color: var(--text); }

/* ---------- VPN: встроенная панель (своя разметка — не зависит от стилей app.css) ---------- */
.ia-panel { position: fixed; inset: 0; z-index: 2000; display: flex; }
.ia-panel-card { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--sidebar, #101614); color: var(--text, #e9efec); animation: ia-panel-in .26s cubic-bezier(.2,.8,.25,1); }
.ia-panel-head { display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 8px 12px; background: var(--sidebar, #101614); border-bottom: 1px solid var(--line-2, rgba(255,255,255,.07)); }
.ia-p-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--text, #e9efec); display: grid; place-items: center; cursor: pointer; flex: none; }
.ia-p-btn:hover { background: var(--hover, rgba(255,255,255,.06)); }
.ia-p-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.ia-p-title b { font-size: 16px; }
.ia-p-title small { color: var(--muted, #8a9690); font-size: 12.5px; }
.ia-panel-body { position: relative; flex: 1; min-height: 0; background: #0a0e1a; }
.ia-p-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.ia-p-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--sidebar, #101614); color: var(--muted, #8a9690); z-index: 1; transition: opacity .2s; }
.ia-panel.loaded .ia-p-loading { opacity: 0; pointer-events: none; }
.ia-p-main { margin: 0; border: 0; padding: 16px; font-weight: 700; font-size: 16px; line-height: 1.2; font-family: inherit; background: #22c55e; color: #05210f; cursor: pointer; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.ia-p-main:disabled { opacity: .6; }
.ia-panel.ia-leaving .ia-panel-card { animation: ia-panel-out .2s ease forwards; }
.ia-pop { z-index: 2600; }
.ia-pop-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.ia-pop-btn { border: 0; border-radius: 11px; padding: 10px 16px; font-weight: 700; font-family: inherit; background: var(--accent, #22c55e); color: var(--on-accent, #05210f); cursor: pointer; }
.ia-pop-btn.ghost { background: var(--panel-2, #1b2420); color: var(--text, #e9efec); }
.ia-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 3000; background: #1b2420; color: #e9efec; padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
@keyframes ia-panel-in { from { opacity: 0; transform: translateX(-18px); } }
@keyframes ia-panel-out { to { opacity: 0; transform: translateX(-18px); } }
@media (min-width: 861px) {
  body.ia-on:not(.ia-collapsed):not(.ia-empty) .ia-panel { left: var(--ia-w); }
}
@media (max-width: 860px) {
  .ia-panel-card { padding-top: env(safe-area-inset-top); }
  @keyframes ia-panel-in { from { opacity: .4; transform: translateX(32px); } }
}
.ia-slow { display: grid; gap: 6px; text-align: center; padding: 0 24px; }
.ia-slow small { color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .ia-badge, .ia-wheel.can .ia-wheel-ico svg { animation: none; }
  .ia-panel-card { animation: none !important; }
}

/* МУЗЫКА: кнопка «Музыка» в панели разделов и оформление панели плеера */
.ia-music-nav .ia-mn-ico { position: relative; display: grid; place-items: center; width: 28px; height: 28px; margin: -3px 0; border-radius: 9px;
  background: linear-gradient(135deg, rgba(45,212,191,.16), rgba(59,130,246,.16)); transition: transform .2s cubic-bezier(.2,1.4,.4,1), background .2s; }
.ia-music-nav:hover .ia-mn-ico { background: linear-gradient(135deg, rgba(45,212,191,.28), rgba(59,130,246,.28)); }
.ia-music-nav:active .ia-mn-ico { transform: scale(.88); }
.ia-music-nav.busy .ia-mn-ico svg { animation: ia-mpulse .8s ease-in-out infinite; }
.ia-music-nav .ia-eq { position: absolute; right: -3px; bottom: -2px; display: none; gap: 1.5px; align-items: flex-end; height: 9px; padding: 1px 2px;
  border-radius: 4px; background: #0d1512; }
.ia-music-nav .ia-eq b { width: 2px; height: 3px; border-radius: 1px; background: #2dd4bf; animation: ia-eq .9s ease-in-out infinite; }
.ia-music-nav .ia-eq b:nth-child(2) { animation-delay: .2s; background: #38bdf8; }
.ia-music-nav .ia-eq b:nth-child(3) { animation-delay: .4s; background: #3b82f6; }
body:has(#ia-panel.ia-music) .ia-music-nav .ia-eq { display: inline-flex; }
body:has(#ia-panel.ia-music) .ia-music-nav { color: #5eead4; }
.ia-panel.ia-music .ia-panel-head { background: linear-gradient(90deg, rgba(20,184,166,.18), rgba(59,130,246,.14)), var(--sidebar, #101614); }
.ia-panel.ia-music .ia-p-title b { background: linear-gradient(90deg, #5eead4, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ia-panel.ia-music .ia-p-loading::before { content: "♪"; display: block; font-size: 34px; margin-bottom: 8px; color: #2dd4bf; animation: ia-mpulse 1s ease-in-out infinite; }
@keyframes ia-eq { 0%, 100% { height: 3px; } 50% { height: 8px; } }
@keyframes ia-mpulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .ia-music-nav .ia-eq b, .ia-music-nav.busy .ia-mn-ico svg, .ia-panel.ia-music .ia-p-loading::before { animation: none; } }

/* МУЗЫКА: раздел «Музыка» в главном меню (плеер в области чата / на весь экран на телефоне) */
.music-view:not([hidden]) {
  grid-column: 3 / -1; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--bg, #0b0f0d); position: relative; animation: mv-in .24s cubic-bezier(.2, .8, .3, 1);
}
.shell.music-open > .stage, .shell.music-open > .profile, .shell.music-open > .files-view { display: none !important; }
.mv-head { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 18px;
  border-bottom: 1px solid var(--line, rgba(255,255,255,.07));
  background: linear-gradient(90deg, rgba(20,184,166,.14), rgba(59,130,246,.10) 60%, transparent), var(--sidebar, #101614); }
.mv-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, rgba(45,212,191,.2), rgba(59,130,246,.2)); }
.mv-title { flex: 1; min-width: 0; }
.mv-title h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em;
  background: linear-gradient(90deg, #5eead4, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mv-title small { color: var(--muted, #8a9690); font-size: 12.5px; }
.mv-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 11px; cursor: pointer;
  background: rgba(255,255,255,.05); color: var(--muted, #aeb9b3); transition: background .15s, color .15s; }
.mv-btn:hover { background: rgba(255,255,255,.1); color: var(--text, #e9efec); }
.mv-body { position: relative; flex: 1; min-height: 0; background: #0a0e1a; }
.mv-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .25s; background: #0a0e1a; }
.music-view.loaded .mv-frame { opacity: 1; }
.mv-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted, #8a9690); font-size: 14px; transition: opacity .2s; }
.music-view.loaded .mv-loading { opacity: 0; pointer-events: none; }
.mv-note { font-size: 38px; color: #2dd4bf; animation: ia-mpulse 1s ease-in-out infinite; }
.music-view.failed .mv-note { animation: none; color: var(--muted, #8a9690); }
@keyframes mv-in { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 860px) {
  .music-view:not([hidden]) { grid-column: 1; grid-row: 1; }
  .shell.music-open > .sidebar { display: none !important; }
  .shell.music-open .rail { display: flex !important; }
  .shell.music-open { grid-template-rows: minmax(0, 1fr) auto; }
  .mv-head { min-height: 54px; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; }
  .mv-ico { width: 34px; height: 34px; border-radius: 10px; }
  .mv-title h2 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .music-view:not([hidden]) { animation: none; } .mv-note { animation: none; } }

/* BANNERS 10.10.2026: «×» на рекламе VPN и «Колесе удачи» — 30px, зона нажатия 44px; пустой ряд схлопывается */
.ia-top[hidden] { display: none !important; }
.ia-top:empty { display: none !important; }
.ia-wheel { position: relative; cursor: pointer; }
#ia-top.ia-top > .ia-wheel { padding-right: 40px; }
.ia-ad-x, #ia-top.ia-top .ia-ad-x { top: 4px; right: 4px; width: 30px; height: 30px; cursor: pointer; z-index: 1; }
.ia-ad-x::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; }
.ia-ad-x:focus-visible { outline: 2px solid var(--accent, #4ade80); outline-offset: 1px; }
@media (max-width: 860px) {
  #ia-top.ia-top > .ia-wheel, #ia-top.ia-top > .ia-ad { padding-right: 36px; }
}
