/* Beta 0.3.10 — Telegram-style Aa root menu + nested submenus. */
.text-toolbar-menu,
.text-heading-submenu,
.text-button-submenu{
  position:fixed!important;
  z-index:3400!important;
  padding:6px!important;
  border-radius:16px!important;
  background:
    linear-gradient(180deg,rgba(255,255,255,.045),rgba(255,255,255,.012)),
    color-mix(in srgb,var(--panel) 78%,transparent)!important;
  border:1px solid rgba(255,255,255,.085)!important;
  box-shadow:
    0 12px 28px rgba(0,0,0,.24),
    inset 0 1px 0 rgba(255,255,255,.055)!important;
  backdrop-filter:blur(16px) saturate(150%)!important;
  -webkit-backdrop-filter:blur(16px) saturate(150%)!important;
  overscroll-behavior:contain;
  scrollbar-width:thin;
}

.text-toolbar-menu{
  width:258px!important;
  min-width:258px!important;
  max-width:min(258px,calc(100vw - 16px))!important;
  max-height:min(390px,calc(var(--visible-vh,100vh) - 20px))!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  -webkit-overflow-scrolling:touch;
}

.text-heading-submenu{
  width:250px!important;
  min-width:250px!important;
  max-width:min(250px,calc(100vw - 16px))!important;
  overflow:hidden!important;
}

.text-button-submenu{
  width:248px!important;
  min-width:248px!important;
  max-width:min(248px,calc(100vw - 16px))!important;
  max-height:min(485px,calc(var(--visible-vh,100vh) - 20px))!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  -webkit-overflow-scrolling:touch;
}

.text-toolbar-menu::-webkit-scrollbar,
.text-button-submenu::-webkit-scrollbar{width:4px}
.text-toolbar-menu::-webkit-scrollbar-thumb,
.text-button-submenu::-webkit-scrollbar-thumb{
  background:rgba(190,205,225,.32);
  border-radius:999px;
}

.text-menu-row{
  width:100%;
  min-height:42px;
  display:grid;
  grid-template-columns:38px minmax(0,1fr) auto;
  align-items:center;
  gap:7px;
  padding:6px 9px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:var(--text);
  text-align:start;
  direction:ltr;
  transition:background .12s ease,transform .1s ease;
}
.text-menu-row:hover,
.text-menu-row.active{
  background:rgba(255,255,255,.055);
}
.text-menu-row:active{transform:scale(.985)}

.text-menu-row.rich-button-entry{
  position:relative;
  margin-top:5px;
  padding-top:9px;
}
.text-menu-row.rich-button-entry::before{
  content:"";
  position:absolute;
  top:-3px;
  left:8px;
  right:8px;
  height:1px;
  background:rgba(255,255,255,.075);
  pointer-events:none;
}

.text-menu-icon{
  width:34px;
  min-width:34px;
  display:grid;
  place-items:center;
  color:color-mix(in srgb,var(--text) 92%,var(--accent) 8%);
  font-size:21px;
  line-height:1;
  font-family:ui-serif,Georgia,serif;
  direction:ltr;
}

.text-menu-label{
  min-width:0;
  color:var(--text);
  font-size:15px;
  font-weight:500;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-align:right;
  direction:rtl;
}

.text-menu-tail{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  min-width:22px;
  direction:ltr;
}
.text-menu-shortcut{
  color:var(--muted);
  font-size:11px;
  font-weight:400;
  white-space:nowrap;
  direction:ltr;
}
.text-menu-arrow{
  color:var(--muted);
  font-size:27px;
  line-height:.8;
  transform:translateY(-1px);
}

.text-menu-row.submenu-open{
  background:color-mix(in srgb,var(--accent) 12%,rgba(255,255,255,.045));
}

.heading-level-row{
  grid-template-columns:44px minmax(0,1fr) auto;
}
.heading-level-row .text-menu-icon{
  width:42px;
  min-width:42px;
  font-size:19px;
  font-weight:600;
}
.heading-level-row .text-menu-label{
  font-size:14px;
}

html.mobile-performance .text-toolbar-menu,
html.mobile-performance .text-heading-submenu,
html.mobile-performance .text-button-submenu{
  backdrop-filter:blur(9px) saturate(125%)!important;
  -webkit-backdrop-filter:blur(9px) saturate(125%)!important;
  box-shadow:0 8px 20px rgba(0,0,0,.20),inset 0 1px 0 rgba(255,255,255,.04)!important;
}
html.mobile-performance .text-menu-row{
  transition:transform .08s ease!important;
}

@media(max-width:430px){
  .text-toolbar-menu{
    width:216px!important;
    min-width:216px!important;
    max-height:min(350px,calc(var(--visible-vh,100vh) - 18px))!important;
  }
  .text-heading-submenu{
    width:154px!important;
    min-width:154px!important;
  }
  .text-button-submenu{
    width:184px!important;
    min-width:184px!important;
  }
  .text-menu-row{
    min-height:37px;
    grid-template-columns:33px minmax(0,1fr) auto;
    gap:5px;
    padding:4px 7px;
  }
  .text-menu-row.rich-button-entry{
    margin-top:4px;
    padding-top:7px;
  }
  .text-menu-icon{
    width:30px;
    min-width:30px;
    font-size:19px;
  }
  .text-menu-label{font-size:14px}
  .text-menu-shortcut{font-size:9.5px}
  .heading-level-row{
    grid-template-columns:38px minmax(0,1fr);
  }
  .heading-level-row .text-menu-tail{display:none}
  .heading-level-row .text-menu-icon{
    width:36px;
    min-width:36px;
    font-size:17px;
  }
  .heading-level-row .text-menu-label{font-size:13px}
}

@media(max-width:370px){
  .text-toolbar-menu{
    width:198px!important;
    min-width:198px!important;
  }
  .text-heading-submenu{
    width:142px!important;
    min-width:142px!important;
  }
  .text-button-submenu{
    width:166px!important;
    min-width:166px!important;
  }
  .text-menu-shortcut{display:none}
}

@media(prefers-reduced-motion:reduce){
  .text-menu-row{transition:none!important}
}
