/* Shared HY V16 editor surface. Scoped to editor roots; no legacy globals. */
[data-hy-rich-root]{--hy-re-line:rgba(86,155,225,.30);--hy-re-cyan:#35eaff;--hy-re-violet:#a657ff;--hy-re-pink:#ff3fc8;--hy-re-ink:#f4f8ff;position:relative;isolation:isolate}
[data-hy-rich-toolbar]{display:flex;align-items:center;gap:4px;min-width:0;overflow-x:auto;overflow-y:visible;padding:6px 8px;border:1px solid transparent;border-radius:14px;background:linear-gradient(145deg,rgba(7,13,27,.96),rgba(1,3,8,.98)) padding-box,conic-gradient(from 0deg,#35eaff,#a657ff,#ff3fc8,#35eaff) border-box;box-shadow:0 0 24px rgba(53,234,255,.13);scrollbar-width:none;isolation:isolate}
[data-hy-rich-toolbar]::before{content:"";position:absolute;inset:-1px;border-radius:inherit;padding:1px;background:conic-gradient(from 0deg,#35eaff,#a657ff,#ff3fc8,#ffd166,#35eaff);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;animation:hy-rich-chroma-breathe 5s ease-in-out infinite;opacity:.9;pointer-events:none;z-index:-1}
[data-hy-rich-toolbar]::-webkit-scrollbar{display:none}
[data-hy-rich-toolbar] button,[data-hy-rich-toolbar] select,[data-hy-rich-toolbar] label{display:inline-grid;place-items:center;flex:0 0 auto;min-width:34px;min-height:34px;padding:6px 9px;border:1px solid rgba(86,155,225,.25);border-radius:9px;background:rgba(4,10,22,.90);color:var(--hy-re-ink,#f4f8ff);cursor:pointer;transition:color .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease}
[data-hy-rich-toolbar] input[type="color"]{width:0;height:0;opacity:0;position:absolute;pointer-events:none}
[data-hy-rich-toolbar] .hy-rich-menu{font-size:12px;max-width:112px;padding-right:20px}
[data-hy-rich-toolbar] button:hover,[data-hy-rich-toolbar] button:focus-visible,[data-hy-rich-toolbar] select:focus-visible{border-color:var(--hy-re-cyan);box-shadow:0 0 14px rgba(53,234,255,.22);outline:none}
[data-hy-rich-toolbar] .hy-rich-active{color:#fff;border-color:var(--hy-re-cyan);background:linear-gradient(135deg,rgba(53,234,255,.22),rgba(166,87,255,.22));box-shadow:0 0 16px rgba(53,234,255,.34),inset 0 -2px var(--hy-re-pink)}
[data-hy-rich-toolbar] .hy-rich-separator{width:1px;height:23px;flex:0 0 1px;background:linear-gradient(transparent,var(--hy-re-cyan),transparent);margin:0 2px}
[data-hy-rich-editor]{min-width:0;outline:none;caret-color:var(--hy-re-cyan)}
[data-hy-rich-toolbar]{position:relative}
[data-hy-rich-toolbar] .hy-rich-group{display:inline-flex;align-items:center;gap:4px;flex:0 0 auto}
[data-hy-rich-toolbar] .hy-rich-menu{min-width:78px;text-align:left}
[data-hy-rich-editor] img{max-width:min(100%,320px);height:auto;object-fit:contain;border-radius:10px;border:1px solid rgba(53,234,255,.35);box-shadow:0 0 16px rgba(53,234,255,.15);vertical-align:middle}
[data-hy-rich-attachments]{display:flex;flex-wrap:wrap;gap:6px;min-width:0}
[data-hy-rich-attachments] img{width:96px;height:72px;object-fit:cover;border-radius:9px}
html[data-mode="light"] [data-hy-rich-toolbar]{--hy-re-ink:#172b49;background:linear-gradient(145deg,rgba(255,255,255,.96),rgba(231,241,255,.95)) padding-box,conic-gradient(from 0deg,#159ecc,#7652e8,#db35a8,#159ecc) border-box;box-shadow:0 8px 24px rgba(55,90,140,.18)}
html[data-mode="light"] [data-hy-rich-toolbar] button,html[data-mode="light"] [data-hy-rich-toolbar] select,html[data-mode="light"] [data-hy-rich-toolbar] label{background:rgba(255,255,255,.82);color:#172b49;border-color:rgba(52,100,166,.28)}
@keyframes hy-rich-chroma-breathe{0%,100%{opacity:.58;filter:brightness(.9);transform:scale(.998)}50%{opacity:1;filter:brightness(1.35);transform:scale(1.002)}}
@media(min-width:721px){[data-hy-rich-toolbar]{overflow-x:auto;scroll-behavior:smooth}}
@media(max-width:720px){
  [data-hy-rich-toolbar]{position:sticky;bottom:env(safe-area-inset-bottom);z-index:100;gap:5px;padding:6px;max-width:100%;touch-action:pan-x;overflow-x:auto;overscroll-behavior-x:contain;background:linear-gradient(145deg,rgba(7,13,27,.98),rgba(1,3,8,.99)) padding-box,conic-gradient(from 0deg,#35eaff,#a657ff,#ff3fc8,#35eaff) border-box}
  [data-hy-rich-toolbar] button,[data-hy-rich-toolbar] select,[data-hy-rich-toolbar] label{min-width:40px;min-height:40px;padding:7px 10px}
  [data-hy-rich-editor]{overflow-wrap:anywhere}
  html.hy-keyboard-open [data-hy-rich-toolbar]{position:fixed;left:8px;right:8px;bottom:calc(var(--hy-keyboard-height,0px) + env(safe-area-inset-bottom) + 6px);width:auto;max-width:none;z-index:10000;box-shadow:0 10px 40px rgba(0,0,0,.58),0 0 28px rgba(53,234,255,.2)}
html.hy-keyboard-open [data-hy-rich-editor]{scroll-margin-bottom:calc(var(--hy-keyboard-height,0px) + 70px)}
}

/* Unified behavior: the formatting rail stays in normal document flow and
   sits directly above its editor. The keyboard must not detach it or cover
   the compose surface. */
[data-hy-rich-toolbar]{position:relative!important;bottom:auto!important;z-index:7000!important;flex-wrap:nowrap!important;max-height:52px!important;overflow-x:auto!important;overflow-y:hidden!important;white-space:nowrap!important}
html.hy-keyboard-open [data-hy-rich-toolbar]{position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;z-index:7000!important;max-height:52px!important}
