/* Beta 0.3 — liquid-glass UI chrome across the Mini App.
   Message blocks stay visually clean so the editor remains WYSIWYG. */

:root{
  --glass-bg:color-mix(in srgb,var(--panel) 62%,transparent);
  --glass-bg-strong:color-mix(in srgb,var(--panel) 76%,transparent);
  --glass-line:rgba(255,255,255,.11);
  --glass-highlight:rgba(255,255,255,.09);
  --glass-shadow:0 12px 34px rgba(0,0,0,.22);
}

body{
  background:
    radial-gradient(900px 420px at 18% -8%,color-mix(in srgb,var(--accent) 14%,transparent),transparent 65%),
    radial-gradient(700px 360px at 100% 18%,rgba(255,255,255,.035),transparent 68%),
    var(--bg);
}

.content-flow{
  display:block;
  margin:0;
  padding:0;
  background:transparent;
  border:0;
  border-radius:0;
  overflow:visible;
  box-shadow:none;
}
.content-flow:empty{display:none}
.block{background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important}
.block.selected{background:transparent!important;border:0!important}
.block.selected:after{
  inset:-2px -4px;
  border-radius:9px;
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 24%,transparent);
}

.editor-topbar,
.toolbar-bubble,
.popup-menu,
.sheet,
.starter-card,
.sheet-item,
.soft-btn,
.primary-soft,
.fab,
.media-picker-card{
  border:1px solid var(--glass-line)!important;
  background:
    linear-gradient(180deg,rgba(255,255,255,.055),rgba(255,255,255,.016)),
    var(--glass-bg)!important;
  box-shadow:var(--glass-shadow),inset 0 1px 0 var(--glass-highlight),inset 0 -1px 0 rgba(0,0,0,.09)!important;
  backdrop-filter:blur(24px) saturate(170%)!important;
  -webkit-backdrop-filter:blur(24px) saturate(170%)!important;
}

.editor-head{
  padding:8px 8px 0;
  background:linear-gradient(180deg,color-mix(in srgb,var(--bg) 72%,transparent),transparent);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  overflow:visible!important;
}

.editor-topbar{
  border-radius:22px;
  padding:11px 12px;
  margin-bottom:8px;
  overflow:visible!important;
}

.page-identity input{font-size:23px}
.page-identity small{font-size:13px}

.top-actions{gap:5px}
.icon-btn{
  width:48px!important;
  height:48px!important;
  background:rgba(255,255,255,.02)!important;
}
.icon-btn svg{width:25px!important;height:25px!important;stroke-width:1.8!important}
.icon-btn:active{background:rgba(255,255,255,.09)!important}

.composer-toolbar.floating-toolbar{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:9px;
  padding:4px 2px 10px;
  overflow:visible!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
  scrollbar-width:none;
}
.composer-toolbar.floating-toolbar::-webkit-scrollbar{display:none}

.toolbar-bubble{
  position:relative;
  isolation:isolate;
  display:flex;
  align-items:center;
  min-width:0;
  height:56px;
  padding:5px 7px;
  border-radius:999px!important;
  overflow:hidden;
}
.toolbar-bubble:before{
  content:"";
  position:absolute;
  z-index:-1;
  left:8%;right:8%;top:-52%;height:72%;
  border-radius:50%;
  background:rgba(255,255,255,.085);
  filter:blur(11px);
  pointer-events:none;
}
.toolbar-bubble:after{
  content:"";
  position:absolute;
  z-index:-1;
  inset:0;
  border-radius:inherit;
  background:linear-gradient(115deg,rgba(255,255,255,.05),transparent 36%,rgba(255,255,255,.02) 68%,transparent);
  pointer-events:none;
}
.history-bubble,.add-bubble{flex:0 0 auto;gap:1px}
.tools-bubble{
  display:flex;
  justify-content:flex-start;
  gap:2px;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-x:contain;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
}
.tools-bubble::-webkit-scrollbar{display:none}

.composer-toolbar.floating-toolbar .toolbar-bubble button{
  position:relative;
  flex:0 0 auto;
  width:46px;
  height:46px;
  display:grid;
  place-items:center;
  padding:0;
  border:0;
  border-radius:50%;
  background:transparent;
  color:var(--text);
  transition:background .16s ease,color .16s ease,transform .12s ease,opacity .16s ease;
}
.composer-toolbar.floating-toolbar .toolbar-bubble button:active{
  transform:scale(.93);
  background:rgba(255,255,255,.09);
}
.composer-toolbar.floating-toolbar .toolbar-bubble button.active{
  background:color-mix(in srgb,var(--accent) 24%,transparent);
  color:var(--accent);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 25%,transparent);
}
.composer-toolbar.floating-toolbar .toolbar-bubble button:disabled{opacity:.28}
.composer-toolbar.floating-toolbar #undoBtn,.composer-toolbar.floating-toolbar #redoBtn{border:0}
.composer-toolbar.floating-toolbar svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.75}
.composer-toolbar.floating-toolbar .glyph{font-size:21px;font-weight:680;line-height:1}
.composer-toolbar button.has-badge:after{display:none!important;content:none!important}

/* Compact floating bubble menus: never inherit the old large bottom/right layout. */
.popup-menu{
  position:fixed!important;
  right:auto!important;
  bottom:auto!important;
  width:min(276px,calc(100vw - 20px))!important;
  max-width:276px!important;
  max-height:min(310px,calc(var(--visible-vh,100vh) - 20px))!important;
  padding:6px!important;
  border-radius:20px!important;
  background:
    linear-gradient(180deg,rgba(255,255,255,.065),rgba(255,255,255,.018)),
    color-mix(in srgb,var(--panel) 74%,transparent)!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  contain:layout paint;
  scrollbar-width:thin;
  transform-origin:top center;
}
.popup-menu.popup-floating{visibility:visible}
.popup-menu .menu-head{display:none!important}
.menu-list{display:grid;gap:2px;padding:0!important}
.menu-item{
  min-height:46px!important;
  border-radius:14px!important;
  padding:8px 10px!important;
  gap:9px!important;
}
.menu-item:hover,.menu-item.active{background:rgba(255,255,255,.065)!important}
.menu-icon{width:31px!important;font-size:20px!important}
.menu-copy strong{font-size:14px!important;line-height:1.2}
.menu-copy small{font-size:11px!important;line-height:1.25}
.menu-sep{margin:3px 7px!important}

.sheet{
  background:var(--glass-bg-strong)!important;
  border-radius:28px 28px 0 0!important;
  border-bottom:0!important;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.sheet-handle{height:5px;width:52px;background:rgba(255,255,255,.38)}
.sheet-header{padding:8px 4px 14px}
.sheet-header strong{font-size:18px}
.sheet-header small{font-size:13px}
.sheet-item{
  min-height:64px;
  border-radius:18px!important;
  background:rgba(255,255,255,.035)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035)!important;
}
.destination-icon{width:46px;height:46px;font-size:23px;background:rgba(255,255,255,.045)!important}

.starter-card{
  border-radius:24px!important;
  border-style:solid!important;
}
.primary-soft,.soft-btn{
  min-height:48px;
  border-radius:16px!important;
  font-weight:650;
}
.primary-soft{
  background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 82%,#fff 8%),color-mix(in srgb,var(--accent) 82%,#000 8%))!important;
  color:var(--accentText)!important;
}

.media-picker-card{
  border-radius:18px!important;
  padding:13px!important;
  background:var(--glass-bg)!important;
}
.media-picker-card.invalid{border-color:color-mix(in srgb,var(--danger) 48%,var(--glass-line))!important}
.media-picker-head{display:flex;align-items:center;gap:12px}
.media-picker-head>div{display:grid;gap:3px;min-width:0}
.media-picker-head strong{font-size:16px}
.media-picker-head small{font-size:12px;color:var(--muted);line-height:1.45}
.media-picker-icon{
  flex:0 0 auto;
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  border-radius:15px;
  font-size:25px;
  background:rgba(255,255,255,.055);
  border:1px solid rgba(255,255,255,.07);
}
.media-pick-btn{justify-self:start;min-width:190px}

.bottom-actions{gap:12px;padding-inline:14px}
.fab{
  width:58px!important;
  height:58px!important;
  border-radius:50%!important;
}
.fab-ghost{width:54px!important;height:54px!important;color:var(--text)!important}
.fab-send{
  width:62px!important;
  height:62px!important;
  background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 86%,#fff 10%),color-mix(in srgb,var(--accent) 88%,#000 8%))!important;
}
.fab svg{width:27px!important;height:27px!important}
.fab-send svg{width:32px!important;height:32px!important}
.fab-send .telegram-logo{
  transform:none!important;
  fill:currentColor!important;
  stroke:none!important;
}
.fab-send .telegram-logo path{
  fill:currentColor!important;
  stroke:none!important;
}

.backdrop{
  background:rgba(4,8,14,.32)!important;
  backdrop-filter:blur(8px) saturate(125%)!important;
  -webkit-backdrop-filter:blur(8px) saturate(125%)!important;
}

/* Mobile performance mode: preserve the glass look without repainting 24px blur everywhere. */
html.mobile-performance body{
  background:var(--bg)!important;
}
html.mobile-performance .editor-topbar,
html.mobile-performance .toolbar-bubble,
html.mobile-performance .popup-menu,
html.mobile-performance .sheet,
html.mobile-performance .starter-card,
html.mobile-performance .sheet-item,
html.mobile-performance .soft-btn,
html.mobile-performance .primary-soft,
html.mobile-performance .fab,
html.mobile-performance .media-picker-card{
  backdrop-filter:blur(10px) saturate(125%)!important;
  -webkit-backdrop-filter:blur(10px) saturate(125%)!important;
  box-shadow:0 6px 18px rgba(0,0,0,.18),inset 0 1px 0 rgba(255,255,255,.055)!important;
}
html.mobile-performance .editor-head{
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
  background:color-mix(in srgb,var(--bg) 91%,transparent)!important;
}
html.mobile-performance .toolbar-bubble:before{
  filter:blur(5px)!important;
  opacity:.62;
}
html.mobile-performance .popup-menu{
  backdrop-filter:blur(12px) saturate(130%)!important;
  -webkit-backdrop-filter:blur(12px) saturate(130%)!important;
}
html.mobile-performance .backdrop{
  backdrop-filter:blur(3px)!important;
  -webkit-backdrop-filter:blur(3px)!important;
}

@media(max-width:390px){
  .composer-toolbar.floating-toolbar{gap:6px}
  .toolbar-bubble{height:52px;padding:4px 5px}
  .composer-toolbar.floating-toolbar .toolbar-bubble button{width:42px;height:42px}
  .composer-toolbar.floating-toolbar svg{width:23px;height:23px}
  .composer-toolbar.floating-toolbar .glyph{font-size:20px}
  .popup-menu{width:min(258px,calc(100vw - 16px))!important;max-width:258px!important;max-height:min(286px,calc(var(--visible-vh,100vh) - 16px))!important}
}

@media(min-width:760px){
  .editor-head{max-width:760px;margin:0 auto}
  .composer-toolbar.floating-toolbar{max-width:720px;margin:0 auto}
}

@media(prefers-reduced-motion:reduce){
  .composer-toolbar.floating-toolbar .toolbar-bubble button{transition:none}
}
