#aiOverlay .chat-screen{--page:#dededc;--paper:#efefed;--ink:#242522;--muted:#797a77;--bubble:#eeeeec;--light:#ffffffc4;--shadow:#88898455;--text-size:17px;--texture:.55;--tear:1;--shadow-strength:.18;--screen-width:390px;width:var(--screen-width);height:clamp(480px,calc(100vh - 260px),800px);max-height:none;position:relative;isolation:isolate;overflow:hidden;border-radius:24px;background:var(--page);color:var(--ink);box-shadow:0 26px 50px #0002,0 2px 3px #0002;flex:none}
#aiOverlay .chat-head{position:absolute;inset:0 0 auto;height:72px;display:flex;align-items:center;justify-content:space-between;padding:15px 17px;z-index:2;background:linear-gradient(var(--paper),transparent)}
#aiOverlay .square{width:44px;height:44px;display:grid;place-items:center;background:transparent;border:0;border-radius:13px}
#aiOverlay .neo{background:var(--bubble);box-shadow:5px 5px 12px var(--shadow),-4px -4px 10px var(--light),inset 0 1px 1px var(--light);border:1px solid #ffffff2b}
#aiOverlay .chat-head{pointer-events:none;background:transparent}
#aiOverlay .chat-head button{pointer-events:auto}
#aiOverlay .chat-head .edit-grip{pointer-events:auto}
#aiOverlay .chat-head .square svg{width:25px;height:25px}
#aiOverlay .chat-scroll{position:absolute;inset:0 0 130px;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:#8885 transparent;padding:84px 16px 35px;overscroll-behavior:contain}
#aiOverlay .portrait.square img{clip-path:none;border-radius:12px}
#aiOverlay .chat-footer{position:absolute;bottom:0;left:0;right:0;padding:0 10px 10px;z-index:3;display:flex;flex-direction:column;align-items:center;gap:14px}
#aiOverlay .faq-trigger{display:flex;align-items:center;justify-content:center;gap:10px;border-radius:24px;min-height:44px;padding:10px 18px;border:1px solid #ffffff40;font-size:14px;font-weight:500;color:var(--ink);position:relative}
#aiOverlay .faq-trigger svg{width:20px;height:20px}
#aiOverlay .chevron{font-size:17px;margin-left:8px}
#aiOverlay .composer-glass{padding:7px;width:100%;border:1px solid #ffffff5c;border-radius:20px;background:color-mix(in srgb,var(--bubble) 55%,transparent);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);box-shadow:0 7px 20px #0002,inset 0 1px 1px #fff8}
#aiOverlay .composer{display:flex;align-items:center;gap:6px;min-height:44px}
#aiOverlay .attach{width:32px;height:40px;display:grid;place-items:center;background:none;border:0;color:var(--ink)}
#aiOverlay .attach svg{width:19px;height:19px}
#aiOverlay .composer textarea{display:block;width:100%;min-height:40px;max-height:120px;resize:none;border:1px solid #fff5;border-radius:22px;padding:10px 12px;background:var(--bubble);box-shadow:inset 2px 2px 4px #0000000d,inset -1px -1px 2px var(--light);color:var(--ink);font-size:16px;line-height:20px}
#aiOverlay .composer textarea::placeholder{color:var(--muted)}
#aiOverlay .send{width:38px;height:38px;border:0;border-radius:50%;background:var(--bubble);color:var(--ink);box-shadow:3px 3px 8px var(--shadow),-2px -2px 7px var(--light),inset 0 1px 1px var(--light);flex:none;display:grid;place-items:center}
#aiOverlay .send svg{width:21px;height:21px}
#aiOverlay .sheet-backdrop{position:absolute;inset:0;background:#0005;backdrop-filter:blur(3px);z-index:10;opacity:0;transition:opacity .22s}
#aiOverlay .sheet-backdrop.visible{opacity:1}
#aiOverlay .faq-sheet{position:absolute;bottom:0;left:0;right:0;max-height:75%;background:linear-gradient(123deg,#fff3 8%,transparent 10%,#00000008 28%,transparent 30%,transparent 64%,#fff4 65%,#00000008 66%,transparent 70%),var(--paper);z-index:11;border-radius:32px 32px 0 0;padding:0 16px 24px;box-shadow:0 -8px 30px #0002;display:flex;flex-direction:column;transform:translateY(105%);opacity:0;transition:transform .28s ease,opacity .2s;isolation:isolate}
#aiOverlay .faq-sheet::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23888' filter='url(%23n)' opacity='.12' d='M0 0h160v160H0z'/%3E%3C/svg%3E");opacity:var(--texture);pointer-events:none}
#aiOverlay .faq-sheet.visible{transform:translateY(0);opacity:1}
#aiOverlay .sheet-handle{padding:13px 0 8px;display:grid;place-items:center;touch-action:none;cursor:grab;flex:none}
#aiOverlay .sheet-handle span{height:5px;width:45px;background:#8889;border-radius:6px}
#aiOverlay .faq-sheet header{display:flex;align-items:center;gap:12px;padding:5px 0 18px;flex:none}
#aiOverlay .faq-sheet h2{font-size:21px;letter-spacing:-.8px;flex:1;margin:0;font-weight:700}
#aiOverlay .faq-list{overflow:auto;overscroll-behavior:contain;padding:6px 3px 12px;scrollbar-width:thin}
#aiOverlay .question{width:100%;display:flex;align-items:center;text-align:left;gap:13px;border-radius:19px;border:1px solid #ffffff70;background:var(--bubble);padding:12px;min-height:58px;margin-bottom:12px;box-shadow:4px 5px 10px var(--shadow),-3px -3px 7px var(--light);color:var(--ink)}
#aiOverlay .question .question-icon{width:32px;height:30px;border-right:1px solid #9995;padding-right:9px;display:grid;place-items:center}
#aiOverlay .question .question-icon svg{width:22px;height:22px}
#aiOverlay .question .question-text{flex:1;font-size:16px;font-weight:500;line-height:1.3}
#aiOverlay .question>svg{width:17px;height:17px}
#aiOverlay .faq-sheet{transform:translateY(105%)!important}
#aiOverlay .faq-sheet.visible{transform:translate(var(--x),var(--y)) rotate(var(--rotate)) scale(var(--scale))!important}
[data-theme=dark] #aiOverlay .chat-screen{--page:#292a28;--paper:#3c3d39;--ink:#efefeb;--muted:#b6b7b0;--bubble:#454640;--light:#ffffff0b;--shadow:#0007}
#aiOverlay .chat-screen{margin:auto}
#aiOverlay .chat-screen{height:clamp(480px,calc(100vh - 260px),760px);border-radius:19px}
#aiOverlay .chat-head>.edit-grip{top:4px;left:60px}
#aiOverlay .chat-screen{height:100dvh;max-height:none;border-radius:0;box-shadow:none}
#aiOverlay .faq-sheet{padding:0 0 20px;border-radius:32px 32px 0 0;background:#f3f3f1 url('assets/fab/cotton.png') center top/100% auto no-repeat;box-shadow:0 -6px 24px #0002;transform:translate3d(0,calc(100% + 32px),0)!important;opacity:1;transition:transform .46s cubic-bezier(.22,.8,.25,1);will-change:transform;overflow:hidden}
#aiOverlay .faq-sheet::before{display:none}
#aiOverlay .faq-sheet.visible{transform:translate3d(0,0,0)!important}
#aiOverlay .faq-sheet header{padding:10px 24px 20px;gap:12px}
#aiOverlay .faq-sheet h2{font-size:24px;font-weight:800;letter-spacing:-.7px}
#aiOverlay .faq-sheet .sheet-icon{width:36px;height:36px;stroke-width:1.6}
#aiOverlay .faq-sheet header .square{width:38px;height:38px;padding:0}
#aiOverlay .sheet-handle{height:28px;flex:none}
#aiOverlay .sheet-handle span{width:48px;height:5px;background:#777;border-radius:4px}
#aiOverlay .faq-list{padding:0 6px 10px}
#aiOverlay .question{display:block;position:relative;padding:0;margin:0 0 4px;border:0;border-radius:0;background:none;box-shadow:none;min-height:0;width:100%;color:#151515}
#aiOverlay .question svg{display:block;width:100%;height:auto;stroke:none;fill:none;overflow:visible}
#aiOverlay .question text{font-family:FAQOswald,Arial,sans-serif;font-size:34px;font-weight:500;fill:#111;stroke:none}
#aiOverlay .question:active{transform:translateY(1px)}
#aiOverlay .faq-sheet .more{margin:4px 22px;min-height:44px}
#aiOverlay .sheet-backdrop{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;transition:opacity .3s ease!important}
#aiOverlay .sheet-backdrop.visible{background:#0003}
#aiOverlay .faq-sheet{transition-duration:.01s!important}
#aiOverlay .faq-sheet{height:min(610px,78%);max-height:94%!important;transition:transform .46s cubic-bezier(.22,.8,.25,1),height .46s cubic-bezier(.22,.8,.25,1)}
#aiOverlay .faq-sheet.expanded{height:94%}
#aiOverlay .faq-list{flex:1;min-height:0}
#aiOverlay .faq-sheet .more{flex:none;border-radius:30px;min-height:48px;background:linear-gradient(#f8f8f7,#e8e8e7);color:#222;box-shadow:3px 5px 9px #0002,inset 0 1px 2px white;font-size:16px;border:1px solid #fff9}
#aiOverlay .faq-sheet header{color:#111}
#aiOverlay .faq-sheet header svg{color:#111}
#aiOverlay .sheet-handle{display:grid;place-items:center}
#aiOverlay .faq-sheet h2 svg{display:block;width:100%;height:auto;fill:#111;stroke:none}
#aiOverlay no stretched lettering. */
.faq-sheet{background:#f4f4f2 url('assets/fab/cotton.png') center top/cover no-repeat;height:auto;max-height:92%!important;padding-bottom:14px}
#aiOverlay .faq-sheet.expanded{max-height:94%!important}
#aiOverlay .faq-list{flex:0 1 auto;padding-bottom:0}
#aiOverlay .faq-sheet.expanded .faq-list{flex:1}
#aiOverlay .question{margin-bottom:3px}
#aiOverlay .question svg{height:62px;max-width:100%}
#aiOverlay .question text{font-family:Arial,Helvetica,sans-serif;font-size:35px;font-weight:600;letter-spacing:-.6px}
#aiOverlay .faq-sheet .more{margin:5px 22px 0;min-height:46px}
#aiOverlay .faq-sheet header{padding-bottom:14px}
#aiOverlay .chat-screen{height:100dvh!important;margin:0!important;flex:none}
#aiOverlay .question svg{height:auto}
#aiOverlay .question text{font-size:42px;font-weight:600}
#aiOverlay .faq-list{gap:0}
#aiOverlay .question{margin-bottom:2px}
#aiOverlay .faq-sheet header{padding-top:6px;padding-bottom:12px}
#aiOverlay .faq-sheet .more{margin-top:4px}
#aiOverlay .chat-scroll{scrollbar-width:none!important}
#aiOverlay .faq-list{scrollbar-width:none!important}
#aiOverlay .chat-screen{--fab-safe-bottom:max(env(safe-area-inset-bottom,0px),var(--tg-safe-area-inset-bottom,0px),var(--tg-content-safe-area-inset-bottom,0px));--native-bottom:var(--fab-bottom-lock,var(--fab-safe-bottom))}
#aiOverlay .chat-footer{padding-bottom:calc(10px + var(--native-bottom))}
#aiOverlay .faq-sheet{bottom:0;max-height:calc(92% - var(--native-bottom))!important}
#aiOverlay .faq-sheet.expanded{max-height:calc(94% - var(--native-bottom))!important}
#aiOverlay .faq-sheet h2{min-width:0;overflow:visible}
#aiOverlay .faq-sheet h2 svg{overflow:visible}
#aiOverlay .faq-sheet header .square{flex:none}
#aiOverlay .sheet-backdrop{backdrop-filter:blur(18px) saturate(.65)!important;-webkit-backdrop-filter:blur(18px) saturate(.65)!important}
#aiOverlay .sheet-backdrop.visible{background:rgba(128,128,128,.26)}
#aiOverlay .chat-screen{--native-top:max(env(safe-area-inset-top,0px),calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px)))}
#aiOverlay .faq-sheet{max-height:min(92%,calc(100% - var(--native-top) - 8px))!important}
#aiOverlay .faq-sheet.expanded{max-height:min(94%,calc(100% - var(--native-top) - 8px))!important}
#aiOverlay .chat-head{top:var(--native-top)}
#aiOverlay .chat-scroll{padding-top:calc(84px + var(--native-top));clip-path:inset(var(--native-top) 0 0 0)}
#aiOverlay optical icon alignment. */
.composer-glass{padding:5px}
#aiOverlay .composer{display:grid;grid-template-columns:40px minmax(0,1fr) 40px;gap:4px;align-items:end}
#aiOverlay .attach{width:40px;height:44px;min-width:0;display:grid;place-items:center;padding:0;border-radius:14px;align-self:end}
#aiOverlay .send{width:40px;height:44px;min-width:0;display:grid;place-items:center;padding:0;border-radius:14px;align-self:end}
#aiOverlay .attach{background:var(--bubble);box-shadow:2px 3px 7px var(--shadow),-2px -2px 5px var(--light);border:1px solid #ffffff40}
#aiOverlay .attach svg{width:23px;height:23px;display:block}
#aiOverlay .send svg{width:23px;height:23px;display:block;stroke-width:1.82}
#aiOverlay .composer textarea{min-width:0;min-height:44px;padding:11px 10px;border-radius:18px}
#aiOverlay .faq-trigger{font-weight:700;line-height:1.2;gap:9px;align-items:center}
#aiOverlay .faq-trigger>svg:first-of-type{width:24px;height:24px;display:block}
#aiOverlay .faq-trigger .chevron{display:block;width:20px;height:20px;margin:0;align-self:center;stroke-width:2.2;flex:none}
#aiOverlay .faq-sheet .sheet-icon{flex:none}
#aiOverlay beneath every UI layer. */
#aiOverlay .chat-screen{background-color:var(--page);background-image:url('assets/fab/cotton.png');background-size:cover;background-position:center;background-repeat:no-repeat;background-blend-mode:multiply}
[data-theme=dark] #aiOverlay .chat-screen{background-color:#41423f;background-blend-mode:multiply}
#aiOverlay without the added gray tint. */
[data-theme=light] #aiOverlay .chat-screen{--page:#fff;background-color:#fff;background-blend-mode:normal;filter:none}
#aiOverlay .composer textarea:focus{outline:none;outline-offset:0;border-color:#ffffff80;box-shadow:inset 2px 2px 4px #0000000d,inset -1px -1px 2px var(--light)}
#aiOverlay .composer textarea:focus-visible{outline:none;outline-offset:0;border-color:#ffffff80;box-shadow:inset 2px 2px 4px #0000000d,inset -1px -1px 2px var(--light)}
#aiOverlay svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}#aiOverlay .symbol-bank{position:absolute;width:0;height:0;overflow:hidden}#aiOverlay .chat-screen{height:100dvh!important;max-height:none;width:100%;max-width:480px;position:relative;overflow:hidden;border-radius:0;box-shadow:none;animation:none}#aiOverlay .chat-scroll{position:absolute;inset:72px 0 138px;padding:12px 16px 20px;display:flex;flex-direction:column;gap:12px}#aiOverlay .chat-head{height:72px}#aiOverlay .chat-author{display:flex;gap:7px;align-items:center;font:600 13px Arial;color:var(--ink);margin-bottom:6px}#aiOverlay .chat-author img{width:28px;height:28px;border-radius:50%;object-fit:cover}#aiOverlay .chat-msg{max-width:92%;flex:none}#aiOverlay .chat-msg.out{align-self:flex-end}#aiOverlay .chat-faq,#aiOverlay .chat-faq-bar{display:none!important}#aiOverlay .faq-sheet[hidden],#aiOverlay .sheet-backdrop[hidden]{display:none!important}#aiOverlay .faq-sheet h2{font:800 24px/1.2 Arial,sans-serif;white-space:normal;letter-spacing:-.7px}#aiOverlay .question svg{width:100%;height:auto;stroke:none}#aiOverlay .question text{font:600 42px Arial,sans-serif;fill:#111}#aiOverlay .chat-footer{padding-bottom:calc(10px + var(--native-bottom))}#aiOverlay .sheet-backdrop{position:absolute;inset:0;z-index:10}#aiOverlay .send svg{stroke-width:1.82}#aiOverlay .chat-head .square{width:44px;height:44px}#aiOverlay textarea:focus,#aiOverlay textarea:focus-visible{outline:none}#aiOverlay .chat-scroll{clip-path:none}#aiOverlay .chat-info{font-size:13px}
@media(prefers-reduced-motion:reduce){#aiOverlay .faq-sheet,#aiOverlay .sheet-backdrop{transition-duration:.01s!important}}

/* Final production overrides; preview frame and editor never participate. */
#aiOverlay .chat-screen{background:#fff url('assets/theme/velvet.webp?v=37d2e08664ce') repeat top right/128px 128px;background-blend-mode:normal}#aiOverlay .faq-sheet{background:#f4f4f2 url('assets/fab/cotton.png') center top/cover no-repeat}#aiOverlay .chat-scroll{scrollbar-width:none!important}#aiOverlay *::-webkit-scrollbar{display:none}#aiOverlay .chat-head{padding-top:15px}#aiOverlay .chat-scroll{top:calc(72px + var(--native-top));bottom:calc(138px + var(--native-bottom))}#aiOverlay .chat-screen .ai-overlay-input{border:1px solid #fff8;background:var(--bubble);font:16px/20px Arial;padding:11px 10px;min-height:44px}#aiOverlay .chat-screen .send{position:static;border:1px solid #fff8;background:var(--bubble);color:var(--ink)}#aiOverlay .faq-sheet header .square{color:#111}
[data-theme=dark] #aiOverlay .chat-screen{background-color:#41423f;background-image:url('assets/fab/cotton.png');background-size:cover;background-repeat:no-repeat;background-blend-mode:multiply}

/* Owner reference: pinned portrait/paper greeting, compact glass header. */
#aiOverlay::before{display:none!important}#aiOverlay .chat-screen{margin:0 auto!important;max-width:760px;display:grid;grid-template-rows:52px auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);padding-top:var(--native-top);box-sizing:border-box;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif}
#aiOverlay .chat-head{grid-row:1;position:relative;inset:auto;height:52px;padding:4px 16px;background:linear-gradient(to bottom,rgba(238,238,236,.88),rgba(238,238,236,.5));backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-bottom:1px solid #fff5;z-index:3}
#aiOverlay .fab-welcome{grid-row:2;position:relative;isolation:isolate;margin:8px 14px 14px;min-height:150px;padding:10px 0 10px 66px;color:#202120}
#aiOverlay .fab-welcome-card{position:relative;min-height:140px;padding:15px 12px 15px 58px;background:#f5f5f3 url('assets/fab/cotton.png') center/cover;clip-path:polygon(0 3%,7% 2%,13% 3%,18% 1%,24% 3%,30% 2%,36% 3%,42% 1%,49% 2%,56% 1%,62% 3%,68% 2%,75% 3%,82% 1%,90% 3%,98% 2%,100% 8%,99% 23%,100% 39%,99% 54%,100% 70%,99% 88%,97% 97%,89% 98%,83% 96%,77% 98%,70% 97%,63% 99%,56% 97%,50% 99%,43% 97%,36% 98%,29% 96%,22% 98%,15% 97%,7% 98%,1% 96%);filter:drop-shadow(0 5px 4px #0002)}
#aiOverlay .fab-welcome h1{font:800 clamp(18px,4.5vw,25px)/1.18 system-ui,-apple-system,"Segoe UI",sans-serif;letter-spacing:-.6px;margin:0 0 7px}#aiOverlay .fab-welcome h1 span{font-size:.8em;white-space:nowrap}#aiOverlay .fab-welcome p{font:400 13px/18px system-ui,-apple-system,"Segoe UI",sans-serif;margin:0 0 7px}#aiOverlay .fab-welcome strong{font:600 13px/18px system-ui,-apple-system,"Segoe UI",sans-serif}
#aiOverlay .fab-welcome-portrait{position:absolute;left:-2px;top:50%;transform:translateY(-50%);width:132px;height:132px;object-fit:contain;z-index:1;pointer-events:none}
#aiOverlay .chat-scroll{grid-row:3;position:relative;inset:auto!important;min-height:0;overflow-y:auto;padding:6px 16px 18px;gap:10px;clip-path:none!important}#aiOverlay .chat-footer{grid-row:4;position:relative;inset:auto;min-width:0;padding-top:6px}#aiOverlay .chat-msg{width:85%;max-width:85%;display:grid;grid-template-columns:40px minmax(0,1fr);gap:9px;margin:0;align-self:flex-start}#aiOverlay .chat-message-body{grid-column:2;min-width:0}#aiOverlay .chat-avatar{width:40px;height:40px;object-fit:cover;border-radius:50%;align-self:start;box-shadow:0 3px 6px #0002}#aiOverlay .chat-msg.out{align-self:flex-end;grid-template-columns:minmax(0,1fr)}#aiOverlay .chat-msg.out .chat-message-body{grid-column:1}#aiOverlay .chat-msg.grouped{margin-top:-5px}#aiOverlay .chat-author{font:500 13px/18px system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;margin-bottom:4px}

[data-theme=dark] #aiOverlay .chat-head{background:#41423fbb}
@media(min-width:560px){#aiOverlay .fab-welcome{width:min(650px,calc(100% - 40px));margin:10px auto 18px;min-height:165px;padding-left:100px}#aiOverlay .fab-welcome-card{padding-left:78px}#aiOverlay .fab-welcome-portrait{width:180px;height:180px}#aiOverlay .fab-welcome p{font-size:15px;line-height:21px}}
@media(max-width:350px){#aiOverlay .fab-welcome{margin-left:9px;margin-right:9px;padding-left:48px}#aiOverlay .fab-welcome-card{padding-left:46px}#aiOverlay .fab-welcome-portrait{width:105px;height:105px}#aiOverlay .fab-welcome p{font-size:12px;line-height:17px}}

/* Compact original reference: only its short caption belongs in the fixed banner. */
#aiOverlay .fab-welcome{display:flex;align-items:center;gap:0;height:88px;min-height:0;width:calc(100% - 28px);padding:0;margin:5px 14px 10px;overflow:visible}#aiOverlay .fab-welcome-portrait{position:static;transform:none;flex:0 0 88px;width:88px;height:88px;object-fit:contain}#aiOverlay .fab-welcome-strip{display:block;flex:1;min-width:0;height:86px;margin-left:-9px;fill:none;stroke:none}#aiOverlay .fab-welcome-portrait,#aiOverlay .fab-welcome-strip{overflow:hidden}#aiOverlay .fab-welcome-portrait{clip-path:circle(49%)}#aiOverlay .fab-welcome-portrait image,#aiOverlay .fab-welcome-strip image{image-rendering:auto}
#aiOverlay .chat-date{align-self:center;flex:none;border-radius:20px;background:#0000000b;color:var(--sub,#777);font:400 12px/18px system-ui,sans-serif;padding:3px 10px;margin:6px auto 12px}#aiOverlay .chat-time{display:block;font:400 11px/16px system-ui,sans-serif;color:var(--sub,#777);margin:5px 5px 0}#aiOverlay .fab-head-actions{display:flex;gap:8px;align-items:center;pointer-events:auto}
@media(min-width:560px){#aiOverlay .fab-welcome{width:min(650px,calc(100% - 40px));height:100px;margin:6px auto 12px}#aiOverlay .fab-welcome-portrait{flex-basis:100px;width:100px;height:100px}#aiOverlay .fab-welcome-strip{height:98px}}
/* UI/UX: full → compact FAQ, independent scrolling, readable live text and icons. */
#aiOverlay .chat-screen{height:var(--fab-chat-height,100dvh)!important}
/* Ввод на телефоне: «?» прозрачная, но место держит - лента не сдвигается. */
#aiOverlay .fab-typing .faq-trigger{visibility:hidden;opacity:0;pointer-events:none}
#aiOverlay .faq-trigger{transition:opacity .15s ease}
#aiOverlay .faq-trigger.compact{width:44px;height:44px;padding:9px;align-self:flex-end;margin-right:3px}
#aiOverlay .faq-trigger.compact>span,#aiOverlay .faq-trigger.compact>.chevron{display:none}
#aiOverlay .fab-keyboard .faq-trigger{display:none}
#aiOverlay .chat-footer{gap:8px}
#aiOverlay .faq-sheet{padding:0 14px calc(14px + var(--native-bottom));border-radius:30px 30px 0 0;opacity:1;transition:transform .36s cubic-bezier(.22,.8,.25,1);overflow:hidden}
#aiOverlay .faq-sheet header{flex:none;padding:6px 8px 14px;align-items:center}
#aiOverlay .faq-sheet h2{font:700 23px/30px system-ui,-apple-system,Roboto,sans-serif;display:flex;align-items:center;gap:10px;letter-spacing:-.5px;overflow:visible}
#aiOverlay .faq-sheet h2>svg{width:31px;height:31px;fill:none;stroke:currentColor;stroke-width:1.8}
#aiOverlay .faq-list{min-height:0;overflow:auto;overflow-x:hidden;overscroll-behavior:contain;padding:2px 3px 0;display:flex;flex-direction:column;gap:8px}
#aiOverlay .question{flex:none;display:grid;grid-template-columns:40px minmax(0,1fr) 20px;gap:12px;align-items:center;min-height:58px;margin:0;padding:10px 15px;border-radius:30px;background:linear-gradient(#f8f8f7,#e8e8e7);box-shadow:3px 4px 7px #0002,inset 0 1px 2px #fff;border:1px solid #fff9;color:#171817;text-align:left}
#aiOverlay .question .fab-faq-label{font:600 16px/21px system-ui,-apple-system,Roboto,sans-serif;letter-spacing:-.3px;border-left:1px solid #aaa;padding-left:12px}
#aiOverlay .question .fab-faq-icon{width:28px;height:28px;stroke:#171817;stroke-width:3.4;fill:none;overflow:visible}
#aiOverlay .question .fab-faq-arrow{width:18px;height:18px;stroke:#171817;stroke-width:2.2;fill:none}
#aiOverlay .faq-sheet .more{margin:8px 3px 0;min-height:50px;flex:none;font:600 16px system-ui}
#aiOverlay .fab-welcome-portrait{clip-path:circle(49.5%)}
#aiOverlay .fab-welcome-strip{margin-left:-1px}
#aiOverlay .fab-file{width:100%;display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:16px;background:var(--bubble);border:1px solid #fff6;box-shadow:2px 3px 8px #0002}
#aiOverlay .fab-file[hidden],#aiOverlay .fab-file img[hidden]{display:none}
#aiOverlay .fab-file img{width:44px;height:44px;object-fit:contain;border-radius:7px;background:#0000000d}
#aiOverlay .fab-file>div{flex:1;min-width:0}
#aiOverlay .fab-file strong{display:block;font:500 13px/18px system-ui;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#aiOverlay .fab-file small{display:block;font:400 12px/17px system-ui;color:var(--muted)}
#aiOverlay .fab-file button{width:44px;height:44px;border:0;border-radius:12px;background:transparent;font:26px system-ui;color:var(--ink)}
#aiOverlay .send:disabled,#aiOverlay .attach:disabled{opacity:.5}
[data-theme=dark] #aiOverlay .chat-screen{--ink:#eee;--muted:#c4c4c1;--sub:#c4c4c1;--bubble:#484946;--light:#ffffff12;--shadow:#0006}
@media(prefers-reduced-motion:reduce){#aiOverlay .faq-sheet{transition:none}}

/* One transparent composition, never two overlapping crops. */
#aiOverlay .fab-welcome{display:block;height:auto;min-height:0;width:calc(100% - 28px);padding:0;margin:0 14px 4px}
#aiOverlay .fab-welcome-art{display:block;width:100%;height:auto;max-height:144px;object-fit:contain;clip-path:inset(5% 0 0);pointer-events:none}
@media(min-width:560px){#aiOverlay .fab-welcome{width:min(510px,calc(100% - 40px));margin:0 auto 6px}}

/* Owner correction: banner belongs to history; compact controls reserve no extra row. */
#aiOverlay .chat-screen{grid-template-rows:52px minmax(0,1fr) auto}
#aiOverlay .chat-scroll{grid-row:2;padding-top:0}
#aiOverlay .chat-footer{grid-row:3;background:transparent;padding-top:0;gap:0}
#aiOverlay .fab-welcome{flex:none;width:min(100%,330px);height:100px;margin:0 auto 5px;padding:0}
#aiOverlay .fab-welcome-art{height:100px;width:100%;max-height:100px;object-fit:contain}
#aiOverlay .chat-msg.out{margin-left:auto!important;margin-right:0!important;align-self:flex-end!important;text-align:left}
#aiOverlay .chat-msg.out .chat-author,#aiOverlay .chat-msg.out .chat-time{text-align:right;justify-content:flex-end}
#aiOverlay .chat-footer:has(.faq-trigger.compact){padding-top:0}
#aiOverlay .faq-trigger.compact{position:absolute;right:13px;bottom:calc(72px + var(--native-bottom));margin:0;z-index:2;background:var(--bubble)}
#aiOverlay .faq-trigger:not(.compact){margin-bottom:8px}
#aiOverlay .composer-glass{background:transparent}
#aiOverlay .question .fab-faq-icon{width:26px;height:26px;object-fit:contain}
/* Same theme surfaces as Profile/payment, no separate white tint. */
:root[data-theme] #aiOverlay .chat-screen{--page:var(--pb-page);--bubble:var(--pb-card);--ink:var(--pb-text);--muted:var(--pb-sub);--sub:var(--pb-sub);background-color:var(--pb-card)!important;background-image:var(--pb-card-image),var(--pb-puff)!important;background-repeat:repeat,no-repeat!important;background-position:top right,center!important;background-size:156px 130px,100% 100%!important;background-blend-mode:normal!important}
:root[data-theme=dark] #aiOverlay .chat-screen{background-image:var(--pb-app-image),var(--pb-puff)!important;background-size:100% 100%,100% 100%!important;background-repeat:no-repeat!important}
#aiOverlay .chat-head{background:color-mix(in srgb,var(--pb-page) 78%,transparent)}

/* Compact floating glass header, history moves underneath it. */
#aiOverlay .chat-screen{grid-template-rows:minmax(0,1fr) auto}
#aiOverlay .chat-scroll{grid-row:1;padding-top:52px}
#aiOverlay .chat-footer{grid-row:2}
#aiOverlay .chat-head{position:absolute;grid-area:auto;left:0;right:0;top:var(--native-top);height:48px;padding:2px 12px;border:0!important;background:color-mix(in srgb,var(--pb-page) 32%,transparent)!important;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
#aiOverlay .chat-head .square.neo{position:relative;isolation:isolate;width:44px;height:44px;background:transparent!important;box-shadow:none!important;border:0}
#aiOverlay .chat-head .square.neo::before{content:'';position:absolute;inset:4px;z-index:-1;border-radius:11px;background:var(--bubble);box-shadow:2px 3px 7px var(--shadow),-2px -2px 6px var(--light);border:1px solid #fff4}
#aiOverlay .chat-head .square svg{width:21px;height:21px}
#aiOverlay .question{min-height:48px;padding:8px 13px;gap:9px;grid-template-columns:34px minmax(0,1fr) 18px;border-radius:25px}
#aiOverlay .question .fab-faq-label{font-size:15px;line-height:20px;padding-left:11px}
#aiOverlay .question .fab-faq-icon{width:24px;height:24px}
#aiOverlay .faq-list{gap:6px}
#aiOverlay .faq-sheet .more{min-height:46px;font-size:15px;margin-top:6px}
/* Compact top: one wide composition, same scroller as dates and messages. */
#aiOverlay .chat-screen{timeline-scope:--fab-history-scroll}
#aiOverlay .chat-scroll{padding-top:56px;row-gap:8px;scroll-timeline-name:--fab-history-scroll;scroll-timeline-axis:block}
#aiOverlay .fab-welcome{width:auto;max-width:none;height:auto;min-height:0;align-self:stretch;margin:0 44px 0;padding:0;overflow:visible}
#aiOverlay .chat-screen:has(.fab-head-actions) .fab-welcome{margin-right:96px}
#aiOverlay .fab-welcome-art{display:block;width:100%;height:auto;max-width:420px;max-height:none;aspect-ratio:2096/474;margin:0 auto;clip-path:none;stroke:none;fill:none;overflow:hidden}
#aiOverlay .fab-welcome+.chat-date{margin-top:0;margin-bottom:6px}
/* Home glass backing: controls stay sharp, content fades beneath the upper layer. */
#aiOverlay .chat-head{isolation:isolate;background:transparent!important;backdrop-filter:none;-webkit-backdrop-filter:none}
#aiOverlay .chat-head::before{content:'';position:absolute;left:0;right:0;top:0;bottom:-6px;z-index:-1;pointer-events:none;background:linear-gradient(180deg,color-mix(in srgb,var(--pb-page) 30%,transparent),color-mix(in srgb,var(--pb-page) 42%,transparent));backdrop-filter:blur(7px) saturate(.7);-webkit-backdrop-filter:blur(7px) saturate(.7);mask-image:linear-gradient(#000 calc(100% - 6px),transparent);-webkit-mask-image:linear-gradient(#000 calc(100% - 6px),transparent);opacity:.18}
@supports (animation-timeline:scroll()) and (timeline-scope:--fab-history-scroll){
 #aiOverlay .chat-head::before{animation:fabHeaderGlass linear both;animation-timeline:--fab-history-scroll;animation-range:0px 40px}
}
@keyframes fabHeaderGlass{from{opacity:0}to{opacity:1}}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){#aiOverlay .chat-head::before{background:var(--pb-page);opacity:.4}}
/* One shared SVG silhouette, anchored to the bubble inside a reserved lane. */
#aiOverlay .chat-msg{--tail-width:12px}
#aiOverlay .chat-msg.inc{--message-paper:color-mix(in srgb,var(--pb-card) 85%,white)}
#aiOverlay .chat-msg.out{--message-paper:color-mix(in srgb,var(--pb-well,var(--pb-card)) 95%,black)}
#aiOverlay .chat-message-body{box-sizing:border-box}
#aiOverlay .chat-msg.inc .chat-message-body{padding-left:var(--tail-width)}
#aiOverlay .chat-msg.out .chat-message-body{padding-right:var(--tail-width)}
#aiOverlay .chat-msg .chat-bubble{position:relative;overflow:visible;border:0;border-radius:17px;padding:12px 14px;font:400 16px/23px system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;white-space:pre-wrap;background:var(--message-paper);box-shadow:none;filter:drop-shadow(2px 3px 4px #00000026)}
#aiOverlay .chat-msg.inc:not(.grouped):not(.typing) .chat-bubble{border-top-left-radius:0}
#aiOverlay .chat-msg.out:not(.grouped):not(.typing) .chat-bubble{border-top-right-radius:0}
#aiOverlay .chat-bubble>.chat-tail{position:absolute;top:0;left:0;width:var(--tail-width);height:14px;transform:translateX(-100%);fill:currentColor;color:var(--message-paper);stroke:none;overflow:visible;pointer-events:none}
#aiOverlay .chat-msg.out .chat-bubble>.chat-tail{left:auto;right:0;transform:translateX(100%) scaleX(-1)}
#aiOverlay .chat-avatar{background:#fff;border:0;padding:0;box-shadow:0 2px 5px #00000016;object-fit:contain;border-radius:50%}
@supports (animation-timeline:scroll()) and (timeline-scope:--fab-history-scroll){#aiOverlay .chat-head::before{opacity:0}}
/* Preserve readable action labels inside the narrower message body. */


/* Finite feedback for NEW messages only; layout and scroll positions never animate. */
#aiOverlay .chat-msg.fab-new.out .chat-bubble{animation:fabMessageOut .18s ease-out both}
#aiOverlay .chat-msg.fab-new.inc .chat-bubble{animation:fabMessageIn .22s ease-out both}
#aiOverlay .chat-msg.fab-new .chat-actions{animation:fabActionsIn .18s ease-out both}
@keyframes fabMessageOut{from{opacity:0;transform:translate(6px,5px)}to{opacity:1;transform:translate(0,0)}}
@keyframes fabMessageIn{from{opacity:0;transform:translate(-6px,5px)}to{opacity:1;transform:translate(0,0)}}
@keyframes fabActionsIn{from{opacity:0}to{opacity:1}}
#aiOverlay .chat-msg.typing .chat-bubble{width:max-content;min-width:56px;min-height:43px;padding:12px 14px;display:flex;align-items:center;letter-spacing:normal}
#aiOverlay .fab-typing-dots{display:inline-flex;align-items:center;gap:4px;height:12px}
#aiOverlay .fab-typing-dots>span{display:block;width:5px;height:5px;border-radius:50%;background:var(--pb-sub,var(--muted));animation:fabTypingDot 1.1s ease-in-out infinite;opacity:.35}
#aiOverlay .fab-typing-dots>span:nth-child(2){animation-delay:.14s}
#aiOverlay .fab-typing-dots>span:nth-child(3){animation-delay:.28s}
@keyframes fabTypingDot{0%,60%,100%{opacity:.35;transform:translateY(0)}28%{opacity:.8;transform:translateY(-2.5px)}}
#aiOverlay.fab-effects-paused .fab-typing-dots>span{animation-play-state:paused}
@media(prefers-reduced-motion:reduce){
 #aiOverlay .chat-msg.fab-new .chat-bubble,#aiOverlay .chat-msg.fab-new .chat-actions,#aiOverlay .fab-typing-dots>span{animation:none!important;transform:none!important;opacity:1}
}



/* Balanced44px controls and a lighter surface, independent of the page gray. */
#aiOverlay .composer-glass{--composer-paper:color-mix(in srgb,var(--pb-card) 35%,white);padding:6px;background:var(--composer-paper)}
#aiOverlay .composer{grid-template-columns:44px minmax(0,1fr) 44px;gap:6px;align-items:end}
#aiOverlay .composer .attach,#aiOverlay .composer .send{width:44px;height:44px;box-sizing:border-box;align-self:end;background:var(--composer-paper);border-radius:14px}
#aiOverlay .chat-screen .composer textarea{box-sizing:border-box;height:44px;min-height:44px;padding:11px 10px;background:color-mix(in srgb,var(--composer-paper) 88%,var(--pb-card));border-radius:18px}
#aiOverlay .faq-trigger.compact{right:13px;bottom:calc(100% + 8px);padding:0;display:grid;place-items:center;background:color-mix(in srgb,var(--pb-card) 35%,white);border-radius:14px}
#aiOverlay .faq-trigger.compact>svg:first-of-type{width:25px;height:25px;transform:none}
#aiOverlay .chat-footer:has(.fab-file:not([hidden])) .faq-trigger.compact{display:none}
#aiOverlay .fab-file{margin-bottom:8px;box-sizing:border-box}
#aiOverlay .fab-keyboard .faq-trigger{display:none}
[data-theme=dark] #aiOverlay .composer-glass{--composer-paper:color-mix(in srgb,var(--pb-card) 90%,white)}
[data-theme=dark] #aiOverlay .faq-trigger.compact{background:color-mix(in srgb,var(--pb-card) 90%,white)}
#aiOverlay .fab-file button{display:grid;place-items:center;padding:0;flex:none;line-height:1}
#aiOverlay .fab-file button svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}

/* FAQ aligns with the composer; mirrored Home glass keeps the chat visible. */
#aiOverlay .faq-sheet{left:10px;right:10px}
#aiOverlay .sheet-backdrop{background:linear-gradient(0deg,color-mix(in srgb,var(--pb-page) 30%,transparent),color-mix(in srgb,var(--pb-page) 42%,transparent))!important;backdrop-filter:blur(7px) saturate(.7)!important;-webkit-backdrop-filter:blur(7px) saturate(.7)!important}

/* Action controls have their own surface; FAQ/suggestion chips remain separate. */
#aiOverlay .chat-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;width:100%;margin-top:8px}
#aiOverlay .chat-actions>.chat-act{box-sizing:border-box;display:grid;grid-template-columns:20px minmax(0,1fr) 18px;align-items:center;gap:8px;width:100%;min-width:0;min-height:50px;padding:10px 12px;border:1px solid #a5a5a5;border-radius:13px;background:#fafafa;color:#303030;box-shadow:0 2px 4px #00000012;font:600 14px/20px system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;letter-spacing:normal;white-space:normal;text-align:center;overflow:visible;text-overflow:clip;cursor:pointer;transition:background-color .12s,border-color .12s}
#aiOverlay .chat-act-label{min-width:0;overflow-wrap:anywhere}
#aiOverlay .chat-act>.chat-act-icon{width:20px;height:20px;stroke-width:1.7}
#aiOverlay .chat-act>.chat-act-arrow{width:18px;height:18px;stroke-width:1.7}
#aiOverlay .chat-actions>.chat-act:active{background:#e9e9e9;border-color:#777;box-shadow:inset 0 1px 2px #00000016}
#aiOverlay .chat-actions>.chat-act:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
[data-theme=dark] #aiOverlay .chat-actions>.chat-act{background:#e2e2e2;color:#242424;border-color:#999;box-shadow:0 2px 4px #0003}
[data-theme=dark] #aiOverlay .chat-actions>.chat-act:active{background:#c9c9c9;border-color:#bcbcbc}

/* Glass covers the native inset too; desktop greeting starts below its controls. */
#aiOverlay .chat-head::before{top:calc(-1 * var(--native-top))}

/* Content-sized bubbles, independent of author/timestamp and action width. */
#aiOverlay .chat-msg{width:fit-content;max-width:85%}
#aiOverlay .chat-message-body{display:flex;flex-direction:column;align-items:flex-start;min-width:0}
#aiOverlay .chat-msg.out .chat-message-body{align-items:flex-end}
#aiOverlay .chat-msg .chat-bubble{width:fit-content;max-width:100%;box-sizing:border-box;overflow-wrap:anywhere}
#aiOverlay .chat-author,#aiOverlay .chat-time{flex:none}
#aiOverlay .chat-bubble>.chat-time{float:none;display:block;text-align:right;white-space:nowrap;font:400 11px/16px system-ui,sans-serif;letter-spacing:normal;margin:5px 0 -3px;opacity:.8}
#aiOverlay .chat-msg.out .chat-bubble>.chat-time{text-align:left}
#aiOverlay .chat-msg:has(.chat-actions),#aiOverlay .chat-msg:has(.chat-attachment){width:85%}
#aiOverlay .chat-msg:has(.chat-actions) .chat-bubble{align-self:flex-start}

#aiOverlay .chat-bubble a{color:inherit;text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere}
#aiOverlay .chat-attachment{display:flex;flex-direction:column;gap:5px;max-width:100%;width:240px;margin-top:5px;white-space:normal}
#aiOverlay .chat-attachment.has-thumb{flex-direction:row;align-items:center;gap:10px}
#aiOverlay .chat-attachment-text{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
#aiOverlay .chat-attachment strong{font:500 13px/18px system-ui;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
#aiOverlay .chat-attachment small{font:12px/17px system-ui;color:var(--muted)}
#aiOverlay .chat-attachment-image{display:flex;align-items:center;justify-content:center;flex:none;min-width:56px;min-height:56px;max-width:120px;border:0;padding:0;border-radius:9px;overflow:hidden;background:#0000000d;color:var(--muted);font:12px/16px system-ui;cursor:zoom-in}
#aiOverlay .chat-attachment-image img{display:block;width:auto;height:auto;max-width:120px;max-height:140px;object-fit:contain;margin:0;border-radius:0}

/* Existing Home viewer respects Telegram controls; only its image transforms. */
#imgViewer{--viewer-top:max(env(safe-area-inset-top,0px),calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px)));--viewer-bottom:max(env(safe-area-inset-bottom,0px),var(--tg-safe-area-inset-bottom,0px),var(--tg-content-safe-area-inset-bottom,0px));padding-top:calc(var(--viewer-top) + 68px);padding-bottom:var(--viewer-bottom);box-sizing:border-box;overscroll-behavior:contain}
#imgViewer .img-viewer-bar{top:var(--viewer-top);padding:10px 16px}
#imgViewer .img-viewer-bar button{min-height:44px}
#imgViewerWrap{min-height:0;touch-action:none}
#imgViewerImg{max-width:92%;max-height:96%;user-select:none;-webkit-user-drag:none}
#imgViewerImg.iv-smooth{transition:transform .12s ease-out}
#imgViewerCap{padding-bottom:10px;max-width:100%;overflow-wrap:anywhere}
@media(prefers-reduced-motion:reduce){#imgViewer,#imgViewerImg.iv-smooth{transition:none}}

#aiOverlay .chat-msg:has(.ai-gallery-preview){width:85%}
#aiOverlay .ai-gallery-preview{width:100%;min-width:0;margin-top:8px}
#aiOverlay .ai-gallery-preview [role=status]{font:13px/18px system-ui;color:var(--muted);margin-bottom:6px}
#aiOverlay .ai-gallery-preview [role=status]:empty{display:none}
#aiOverlay .ai-gallery-preview .ai-gallery-caption{display:block;margin:0 0 6px;font:700 15px/20px system-ui;color:var(--ink);letter-spacing:.01em;text-wrap:balance}
#aiOverlay .chat-gallery-collage{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:6px;aspect-ratio:4/3;width:100%;overflow:hidden;border-radius:12px}
#aiOverlay .chat-gallery-collage[hidden]{display:none}
#aiOverlay .chat-gallery-collage[data-count="3"]{grid-template-columns:2fr 1fr}
#aiOverlay .chat-gallery-collage[data-count="3"]>:first-child{grid-row:1 / 3}
#aiOverlay .chat-gallery-collage[data-count="1"],#aiOverlay .chat-gallery-collage[data-count="2"]{grid-template-rows:minmax(0,1fr)}
#aiOverlay .chat-gallery-collage[data-count="1"]{grid-template-columns:minmax(0,1fr)}
#aiOverlay .chat-gallery-tile{min-width:0;min-height:0;padding:0;border:0;border-radius:8px;overflow:hidden;background:var(--bubble);color:var(--ink);cursor:zoom-in}
#aiOverlay .chat-gallery-tile img{display:block;width:100%;height:100%;object-fit:cover;margin:0}
#aiOverlay .ai-gallery-preview .chat-actions{margin-top:8px}

/* Reserve space at the scroll end, not a permanent footer band, for floating FAQ. */
#aiOverlay .chat-screen:has(.faq-trigger.compact) .chat-scroll{padding-bottom:70px}
#aiOverlay .chat-screen.fab-keyboard .chat-scroll,#aiOverlay .chat-screen:has(.fab-file:not([hidden])) .chat-scroll{padding-bottom:18px}

/* Header row: the banner lives in the header glass between the controls (6px from the 44px buttons,
   12px header inset) and stays there: messages scroll underneath. The header grows with the banner;
   JS publishes its height as --fab-head-h so the history starts right below it.
   Owner-only diagnostics: the copy button hangs under the clear button (own column). */
#aiOverlay .chat-head{height:auto;min-height:48px;align-items:center}
#aiOverlay .chat-screen .chat-head .fab-welcome{flex:1 1 0;min-width:0;width:auto;max-width:none;height:auto;min-height:0;margin:0 6px;padding:0;align-self:center;pointer-events:none}
#aiOverlay .chat-head .fab-welcome-art{max-width:274px}
#aiOverlay .chat-scroll{padding-top:calc(var(--fab-head-h,52px) + 6px)}
#aiOverlay .chat-head::before{animation:none!important;opacity:1!important}
#aiOverlay .fab-head-actions{position:relative;display:block;width:44px;height:44px;flex:none}
#aiOverlay .chat-head .fab-head-actions>.square.neo[aria-label="Копировать переписку"]{position:absolute;top:calc(100% + 4px);right:0}

/* Action buttons follow the bubble width (mobile and desktop): the group adds nothing to the
   message width, the body shrinks to the bubble, a floor keeps the label on one line. */
#aiOverlay .chat-msg:has(.chat-actions) .chat-message-body{justify-self:start;width:100%;min-width:min(244px,100%);max-width:100%}
#aiOverlay .chat-msg:has(.chat-actions) .chat-bubble{align-self:stretch;width:100%}
#aiOverlay .chat-msg .chat-message-body>.chat-actions{width:0;min-width:100%}

/* Chat surface: no white glow (light shadows off), white glass composer with solid plates that
   stand out, round help button, stronger dark shadows for bubbles and action buttons. */
:root[data-theme] #aiOverlay .chat-screen{--light:transparent;--plate:#fcfcfb;--plate-edge:#0000001f;--lift:0 2px 5px #0000003b,0 1px 2px #00000030}
:root[data-theme=dark] #aiOverlay .chat-screen{--plate:#5a5b55;--plate-edge:#00000066;--lift:0 3px 7px #00000080,0 1px 2px #00000066}
#aiOverlay .neo,#aiOverlay .composer .attach,#aiOverlay .composer .send,#aiOverlay .faq-trigger.compact{border:1px solid var(--plate-edge)}
#aiOverlay .composer-glass{background:#ffffff4d;border:1px solid #ffffff99;backdrop-filter:blur(16px) saturate(1.15);-webkit-backdrop-filter:blur(16px) saturate(1.15);box-shadow:0 6px 18px #00000026}
:root[data-theme=dark] #aiOverlay .composer-glass{background:#ffffff1a;border-color:#ffffff33;box-shadow:0 6px 18px #0006}
#aiOverlay .composer .attach,#aiOverlay .composer .send,#aiOverlay .faq-trigger.compact{background:var(--plate);box-shadow:var(--lift)}
#aiOverlay .chat-screen .composer textarea{background:var(--plate);border:1px solid var(--plate-edge);box-shadow:inset 0 1px 3px #00000026}
#aiOverlay .faq-trigger.compact{width:44px;height:44px;border-radius:50%}
#aiOverlay .chat-head .square.neo::before{background:var(--plate);box-shadow:var(--lift);border:1px solid var(--plate-edge)}
#aiOverlay .chat-msg .chat-bubble{filter:drop-shadow(1px 2px 2px #0000004d) drop-shadow(3px 6px 9px #00000038)}
#aiOverlay .chat-actions>.chat-act{box-shadow:0 2px 6px #0000003b}

/* Light theme: the page takes the crumpled paper of the FAQ sheet, the old velvet grain moves
   into the bubbles (Klyaks lighter, the client a bit darker). Dark theme stays as it was. */
:root[data-theme=light] #aiOverlay .chat-screen{background-color:#f1f1ef!important;background-image:url('assets/fab/cotton.png')!important;background-size:cover!important;background-position:center top!important;background-repeat:no-repeat!important}
:root[data-theme=light] #aiOverlay .chat-msg.inc{--message-paper:#dfdfdd}
:root[data-theme=light] #aiOverlay .chat-msg.out{--message-paper:#cbcbc9}
:root[data-theme=light] #aiOverlay .chat-msg .chat-bubble{background-color:var(--message-paper);background-image:url('assets/theme/velvet.webp?v=37d2e08664ce');background-size:156px 130px}

/* Light theme: the bubble tail gets the same texture (masked by the tail shape), so tail and
   bubble read as one piece. Inc tail continues the bubble tile; the out tail is mirrored. */
:root[data-theme=light] #aiOverlay .chat-bubble>.chat-tail{fill:none;background:var(--message-paper) url('assets/theme/velvet.webp?v=37d2e08664ce') 144px 0/156px 130px;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M1 0H12V14C9 9 5 5 1 2Q-1 0 1 0Z'/%3E%3C/svg%3E") center/100% 100% no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M1 0H12V14C9 9 5 5 1 2Q-1 0 1 0Z'/%3E%3C/svg%3E") center/100% 100% no-repeat}
:root[data-theme=light] #aiOverlay .chat-bubble>.chat-tail use{display:none}

/* Optical centering of the composer icons inside the 44px buttons. Measured on the rendered glyph:
   the plane's box was centred but its ink mass sat 1px right and 1.8px up (tip at the top right);
   it moves 0.9px left and 1px down, which balances box and mass. The clip is 0.4px off to the left. */
#aiOverlay .composer .send svg{transform:translate(-.9px,1px)}
#aiOverlay .composer .attach svg{transform:translate(.4px,-.3px)}

/* FAQ sheet: the list used to clip the capsules' right shadow (3px side padding, overflow hidden), which
   left a flat light strip along the right edge. The list gets room for the shadow (and keeps the capsule
   position through the negative margin), shadows are symmetric, the border is a thin dark edge instead
   of white, and the last capsule no longer touches "Ещё вопросы". */
#aiOverlay .faq-sheet .faq-list{margin:0 -9px;padding:2px 12px 10px}
#aiOverlay .faq-sheet .question,#aiOverlay .faq-sheet .more{border:1px solid #0000001a;box-shadow:0 3px 8px #0000002e,0 1px 2px #0000001f,inset 0 1px 1px #ffffffb3}
#aiOverlay .faq-sheet .more{margin-top:0}
#aiOverlay .faq-sheet{padding-bottom:18px}

/* Last message sits closer to the composer (was 70px with the "?" button, even with the keyboard open
   because :has() outranked the keyboard rule). The "?" button may touch the corner of a right-hand bubble. */
#aiOverlay .chat-screen:has(.faq-trigger.compact) .chat-scroll{padding-bottom:36px}
#aiOverlay .chat-screen.fab-keyboard:has(.faq-trigger.compact) .chat-scroll,#aiOverlay .chat-screen.fab-keyboard .chat-scroll,#aiOverlay .chat-screen:has(.fab-file:not([hidden])) .chat-scroll{padding-bottom:10px}

/* FAQ sheet: my 18px bottom padding had dropped the native inset, so "Ещё вопросы" went under the Android
   system buttons. The paper still reaches the bottom edge (texture under the buttons); only the content
   is lifted. The sheet never grows under the Telegram buttons at the top. */
#aiOverlay .faq-sheet{padding-bottom:calc(18px + var(--native-bottom));max-height:min(92%,calc(100% - var(--native-top) - 8px))!important}
#aiOverlay .faq-sheet.expanded{max-height:min(94%,calc(100% - var(--native-top) - 8px))!important}

/* Открытие чата без моргания: лента скрыта, пока история не отрисована и не прокручена вниз */
#aiOverlay .chat-scroll{transition:opacity .16s ease,padding-bottom .22s cubic-bezier(.4,0,.2,1)}
@media(prefers-reduced-motion:reduce){#aiOverlay .chat-scroll{transition:none}}
#aiOverlay.ai-opening .chat-scroll{opacity:0;transition:none}

/* Нажатие кнопок чата: плашка вдавливается в лунку (как .nm.pressable по приложению).
   Класс .pressed держит JS минимум ~180 мс, чтобы быстрый тап был виден. */
#aiOverlay .composer .attach,#aiOverlay .composer .send,#aiOverlay .faq-trigger.compact{transition:box-shadow .1s ease,background-color .1s ease}
#aiOverlay .composer .attach svg,#aiOverlay .composer .send svg{transition:transform .1s ease}
#aiOverlay .chat-screen{--press-bg:#ecece9;--press-in:inset 2px 3px 6px #00000052,inset -1px -1px 3px #ffffff99}
:root[data-theme=dark] #aiOverlay .chat-screen{--press-bg:#4b4c47;--press-in:inset 2px 3px 7px #000000b3,inset -1px -1px 2px #ffffff14}
#aiOverlay .composer .attach:is(:active,.pressed),#aiOverlay .composer .send:is(:active,.pressed),#aiOverlay .faq-trigger.compact:is(:active,.pressed){background:var(--press-bg);box-shadow:var(--press-in)}
#aiOverlay .composer .attach:is(:active,.pressed) svg{transform:translate(.4px,.7px) scale(.94)}
#aiOverlay .composer .send:is(:active,.pressed) svg{transform:translateY(1px) scale(.94)}
#aiOverlay .chat-head .square.neo:is(:active,.pressed)::before{background:var(--press-bg);box-shadow:var(--press-in)}

/* Читаемость текста в баблах: плотнее шрифт, акценты жирным, аккуратные списки */
#aiOverlay .chat-msg .chat-bubble{font:500 15.5px/22px system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;letter-spacing:.005em;-webkit-font-smoothing:antialiased}
#aiOverlay .chat-bubble strong{font-weight:700}
#aiOverlay .chat-bubble .fab-li{display:block;padding-left:.8em;text-indent:-.8em;margin:2px 0}
#aiOverlay .chat-bubble .fab-num{padding-left:1.45em;text-indent:-1.45em}
#aiOverlay .chat-bubble .fab-num .fab-dot{width:1.45em}
#aiOverlay .chat-bubble{text-wrap:pretty}
#aiOverlay .chat-bubble .fab-par{display:inline-block;max-width:100%;text-indent:0}
#aiOverlay .chat-bubble{hyphens:manual}
#aiOverlay .chat-bubble .fab-nb{white-space:nowrap}
#aiOverlay .chat-bubble .fab-dot{display:inline-block;width:.8em;text-indent:0;font-weight:700;opacity:.5}

/* Шрифт чата: Roboto Flex (UP Hero, уже грузится для hero): одинаковый на всех устройствах, вес и ширина настраиваются.
   Чуть уже стандартной ширины и без лишнего межбуквенного интервала. */
#aiOverlay .chat-msg .chat-bubble{font-family:'UP Hero',system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-weight:480;font-stretch:95%;font-size:15.5px;line-height:22px;letter-spacing:-.008em;font-optical-sizing:auto;word-spacing:0}
#aiOverlay .chat-bubble strong{font-weight:700}
#aiOverlay .chat-screen .composer textarea.ai-overlay-input{font-family:'UP Hero',system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-weight:500;font-stretch:95%;font-size:16px;line-height:20px;letter-spacing:-.008em}
#aiOverlay .chat-screen .composer textarea.ai-overlay-input::placeholder{font-weight:450;opacity:.7}
#aiOverlay .chat-author{font-family:'UP Hero',system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-weight:600;font-stretch:95%;letter-spacing:0}
#aiOverlay .chat-bubble>.chat-time,#aiOverlay .chat-date{font-family:'UP Hero',system-ui,sans-serif;font-weight:500;font-stretch:95%}

/* Строки «тираж / цена»: прижаты влево, обычные пробелы вокруг «/»; пустые строки у списков делают узкий зазор */
#aiOverlay .chat-bubble .fab-row{display:block;margin:2px 0;font-variant-numeric:tabular-nums lining-nums}
#aiOverlay .chat-bubble .fab-sep{opacity:.55;white-space:pre}
#aiOverlay .chat-bubble .fab-gap{display:block;height:.45em}

/* Материалы: название жирно, описание на следующей строке */
.chat-bubble .fab-mat{display:block;margin:.5em 0 .1em}
.chat-bubble .fab-mat strong{font-weight:800;font-variation-settings:'wght' 800}
.chat-bubble .fab-desc{display:block;opacity:.88}
.chat-bubble .fab-old{opacity:.55;text-decoration-thickness:1.5px}
#aiOverlay .chat-act-label{text-wrap:balance;letter-spacing:-.01em}

/* Складки на фоне чата под сообщениями: четыре замятых места (рельеф с тенями) и две мягкие складки, всё под пузырями */
#aiOverlay .chat-screen::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;pointer-events:none;background:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 400 800%22 preserveAspectRatio=%22none%22%3E%3Cdefs%3E%3Cfilter id=%22b%22 x=%22-30%25%22 y=%22-30%25%22 width=%22160%25%22 height=%22160%25%22%3E%3CfeGaussianBlur stdDeviation=%223%22/%3E%3C/filter%3E%3Cfilter id=%22s%22 x=%22-30%25%22 y=%22-30%25%22 width=%22160%25%22 height=%22160%25%22%3E%3CfeGaussianBlur stdDeviation=%221.4%22/%3E%3C/filter%3E%3CradialGradient id=%22rg%22%3E%3Cstop offset=%220%22 stop-color=%22%23fff%22/%3E%3Cstop offset=%22.35%22 stop-color=%22%23fff%22 stop-opacity=%22.8%22/%3E%3Cstop offset=%221%22 stop-color=%22%23fff%22 stop-opacity=%220%22/%3E%3C/radialGradient%3E%3Cmask id=%22fm%22 maskContentUnits=%22objectBoundingBox%22%3E%3Crect width=%221%22 height=%221%22 fill=%22url(%23rg)%22/%3E%3C/mask%3E%3ClinearGradient id=%22es%22 gradientUnits=%22userSpaceOnUse%22 x1=%22140%22 y1=%2292%22 x2=%22305%22 y2=%2240%22%3E%3Cstop offset=%220%22 stop-color=%22%235d584e%22 stop-opacity=%220%22/%3E%3Cstop offset=%22.35%22 stop-color=%22%235d584e%22 stop-opacity=%220.55%22/%3E%3Cstop offset=%22.7%22 stop-color=%22%235d584e%22 stop-opacity=%220.39%22/%3E%3Cstop offset=%221%22 stop-color=%22%235d584e%22 stop-opacity=%220%22/%3E%3C/linearGradient%3E%3ClinearGradient id=%22eh%22 gradientUnits=%22userSpaceOnUse%22 x1=%22140%22 y1=%2292%22 x2=%22305%22 y2=%2240%22%3E%3Cstop offset=%220%22 stop-color=%22%23ffffff%22 stop-opacity=%220%22/%3E%3Cstop offset=%22.35%22 stop-color=%22%23ffffff%22 stop-opacity=%221.0%22/%3E%3Cstop offset=%22.7%22 stop-color=%22%23ffffff%22 stop-opacity=%220.70%22/%3E%3Cstop offset=%221%22 stop-color=%22%23ffffff%22 stop-opacity=%220%22/%3E%3C/linearGradient%3E%3ClinearGradient id=%22fs%22 gradientUnits=%22userSpaceOnUse%22 x1=%22318%22 y1=%22150%22 x2=%22405%22 y2=%22116%22%3E%3Cstop offset=%220%22 stop-color=%22%235d584e%22 stop-opacity=%220%22/%3E%3Cstop offset=%22.35%22 stop-color=%22%235d584e%22 stop-opacity=%220.55%22/%3E%3Cstop offset=%22.7%22 stop-color=%22%235d584e%22 stop-opacity=%220.39%22/%3E%3Cstop offset=%221%22 stop-color=%22%235d584e%22 stop-opacity=%220%22/%3E%3C/linearGradient%3E%3ClinearGradient id=%22fh%22 gradientUnits=%22userSpaceOnUse%22 x1=%22318%22 y1=%22150%22 x2=%22405%22 y2=%22116%22%3E%3Cstop offset=%220%22 stop-color=%22%23ffffff%22 stop-opacity=%220%22/%3E%3Cstop offset=%22.35%22 stop-color=%22%23ffffff%22 stop-opacity=%221.0%22/%3E%3Cstop offset=%22.7%22 stop-color=%22%23ffffff%22 stop-opacity=%220.70%22/%3E%3Cstop offset=%221%22 stop-color=%22%23ffffff%22 stop-opacity=%220%22/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d=%22M140 92Q225 72 305 40%22 fill=%22none%22 stroke-linecap=%22round%22 stroke=%22url(%23es)%22 stroke-width=%224.9%22 opacity=%22.4%22 filter=%22url(%23b)%22/%3E%3Cpath d=%22M140 92Q225 72 305 40%22 fill=%22none%22 stroke-linecap=%22round%22 stroke=%22url(%23es)%22 stroke-width=%22.9%22 opacity=%22.5%22 filter=%22url(%23s)%22/%3E%3Cpath d=%22M140 92Q225 72 305 40%22 fill=%22none%22 stroke-linecap=%22round%22 transform=%22translate(1.5 4)%22 stroke=%22url(%23eh)%22 stroke-width=%223.5%22 opacity=%22.8%22 filter=%22url(%23b)%22/%3E%3Cpath d=%22M318 150Q368 140 405 116%22 fill=%22none%22 stroke-linecap=%22round%22 stroke=%22url(%23fs)%22 stroke-width=%224.9%22 opacity=%22.4%22 filter=%22url(%23b)%22/%3E%3Cpath d=%22M318 150Q368 140 405 116%22 fill=%22none%22 stroke-linecap=%22round%22 stroke=%22url(%23fs)%22 stroke-width=%22.9%22 opacity=%22.5%22 filter=%22url(%23s)%22/%3E%3Cpath d=%22M318 150Q368 140 405 116%22 fill=%22none%22 stroke-linecap=%22round%22 transform=%22translate(1.5 4)%22 stroke=%22url(%23fh)%22 stroke-width=%223.5%22 opacity=%22.8%22 filter=%22url(%23b)%22/%3E%3C/svg%3E") 0 0/100% 100% no-repeat}
[data-theme=dark] #aiOverlay .chat-screen::before{opacity:.35}

/* Замятые места на фоне чата: куски настоящей текстуры бумаги (cotton.png) с складками, повёрнутые и размытые по краям. Только светлая тема, под пузырями */
#aiOverlay .fab-crumples{position:absolute;inset:0;z-index:-1;pointer-events:none;overflow:hidden;border-radius:inherit}
#aiOverlay .fab-crumples i{position:absolute;display:block;background:url('assets/fab/cotton.png') no-repeat;-webkit-mask-image:radial-gradient(ellipse closest-side,#000 38%,#0000 100%);mask-image:radial-gradient(ellipse closest-side,#000 38%,#0000 100%)}
[data-theme=dark] #aiOverlay .fab-crumples{display:none}
#aiOverlay .fab-crumples i:nth-child(1){left:-8px;top:123px;width:216px;height:144px;background-size:752px 752px;background-position:-450px -12px;transform:rotate(-6deg)}
#aiOverlay .fab-crumples i:nth-child(2){left:182px;top:295px;width:236px;height:101px;background-size:565px 565px;background-position:-329px -464px;transform:rotate(-12deg)}
#aiOverlay .fab-crumples i:nth-child(3){left:17px;top:421px;width:156px;height:138px;background-size:752px 752px;background-position:-0px -24px;transform:rotate(24deg)}
#aiOverlay .fab-crumples i:nth-child(4){left:250px;top:520px;width:150px;height:80px;background-size:627px 627px;background-position:-420px -85px;transform:rotate(-14deg) scaleX(-1)}

/* Путь по приложению: плашки со стрелками, последняя (куда попадаем) тёмная */
#aiOverlay .chat-bubble .fab-path{display:flex;flex-wrap:wrap;align-items:center;gap:5px 3px;margin:6px 0 4px;text-indent:0}
#aiOverlay .chat-bubble .fab-hop{display:inline-flex;align-items:center;gap:3px;white-space:nowrap}
/* Три шага и больше - столбиком: в карточке на строку влезает ~190-236 px, три плашки со стрелками занимают ~237 */
#aiOverlay .chat-bubble .fab-path.fab-col{flex-direction:column;align-items:flex-start;flex-wrap:nowrap;gap:0}
#aiOverlay .chat-bubble .fab-col .fab-hop{flex-direction:column;align-items:flex-start;gap:0}
#aiOverlay .chat-bubble .fab-col .fab-arr{display:block;margin:1px 0 1px 12px;line-height:14px;transform:rotate(90deg)}
#aiOverlay .chat-bubble .fab-step{display:inline-block;padding:2px 7px 3px 6px;border:1px solid #8c8c8c;border-radius:999px;background:#ffffffb0;color:#242424;font-weight:700;font-size:12px;line-height:18px;white-space:nowrap}
#aiOverlay .chat-bubble .fab-ico{width:12px;height:12px;margin:-2px 3px -2px -1px;vertical-align:middle;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
#aiOverlay .chat-bubble .fab-step.fab-end{background:#242424;border-color:#242424;color:#f4f4f4}
#aiOverlay .chat-bubble .fab-arr{font-weight:700;font-size:12px;line-height:18px;opacity:.5}
/* Капсулы тянутся на ширину текста (fitPaths в fab-paper-chat.js задаёт ширину цепочки): ряд делит лишнее место поровну, в колонке капсулы на всю ширину. */
#aiOverlay .chat-bubble .fab-path:not(.fab-col) .fab-hop{display:flex;flex:1 1 auto}
#aiOverlay .chat-bubble .fab-path:not(.fab-col) .fab-step{flex:1 1 auto;text-align:center}
#aiOverlay .chat-bubble .fab-path.fab-col{align-items:stretch}
#aiOverlay .chat-bubble .fab-col .fab-hop{align-items:stretch}
#aiOverlay .chat-bubble .fab-col .fab-step{text-align:center}
#aiOverlay .chat-bubble .fab-col .fab-arr{align-self:center;margin:1px 0}
/* Главная кнопка ответа (is-hot): тонкая чёрная рамка. У последнего ответа по рамке постоянно бежит чёрная линия 1.5px
   (её рисует fab-feedback.js через --fab-g, размер кнопки не меняется). */
#aiOverlay .chat-actions>.chat-act.is-hot{--fab-ring:#1b1b1b;--fab-base:#a5a5a5;position:relative;border-color:var(--fab-ring);background:#fff;box-shadow:0 0 0 .5px var(--fab-ring),0 3px 8px #0000004d}
#aiOverlay .chat-actions>.chat-act.is-hot .chat-act-arrow{transform:translateX(2px)}
[data-theme=dark] #aiOverlay .chat-actions>.chat-act.is-hot{--fab-ring:#fff;--fab-base:#6b6b6b;background:#f4f4f4}
#aiOverlay .chat-actions>.chat-act.is-hot.fab-snaking::before{content:'';position:absolute;inset:-1.5px;padding:1.5px;border-radius:13.5px;pointer-events:none;background:var(--fab-g,none);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask-composite:exclude;animation:fabRingIn .2s ease-out both}
@keyframes fabRingIn{from{opacity:0}to{opacity:1}}
