/* 🤖 #726 Robotukas prie pelės (js/cursor-buddy.js) — skrenda šalia kursoriaus, užvedus ant mygtuko pasako, ką jis daro.
   Nieko nespaudžia (pointer-events: none) — tik rodo. Spalvos — programos rėmo (chrome-site.css) tonai. */
#cursor-buddy {
    position: fixed; left: 0; top: 0; z-index: 2147483000; pointer-events: none;
    width: 40px; height: 46px; opacity: 0; transition: opacity .25s ease;
    will-change: transform; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45));
}
html.cb-on #cursor-buddy.matomas, #cursor-buddy.atsisveikina { opacity: 1; }   /* atsisveikina — išjungus dar ~6 s pasako, kur jį rasti */
html.cb-on #cursor-buddy.matomas.spaudzia { opacity: .28; }
/* 🧭 #1530 spaudžiant scenoje (tempi detalę, suki, vedi vamzdį) ir vedimo režime — robotukas visai pasislepia (tada trukdo labiausiai) */
html.cb-on #cursor-buddy.matomas.spaudzia.virs-scenos, #cursor-buddy.slepiasi:not(.atsisveikina) { opacity: 0 !important; }
/* klausimas projektų sąraše: robotukas matomas, nors dar nepasirinkta (html.cb-on dar nėra) */
html.cb-klausia #cursor-buddy.matomas { opacity: 1; }
/* #3429 dešinio klavišo meniu scenoje ir „⋯“ meniu atsidaro po pele, o robotukas skrenda šalia jos (+26 px, +22 px) — uždengdavo
   pirmus punktus („Dubliuoti“, „Į scenos centrą“). Kol toks meniu atidarytas — robotukas ir jo debesėlis nesimato. */
html:has(:is(.scene-ctx-menu, .dropdown-menu)[style*="display: block"]) :is(#cursor-buddy, #cursor-buddy-bubble) { opacity: 0 !important; visibility: hidden !important; }
/* #844 kol rodomas įkrovimo ekranas („Loading…“ / „Loading project…“) — robotukas ir jo burbulas nesimato (kabėdavo virš uždangos) */
html:has(#loading-screen:not([style*="none"])) :is(#cursor-buddy, #cursor-buddy-bubble) { opacity: 0 !important; visibility: hidden !important; transition: none !important; }
#cursor-buddy .cb-kunas { width: 40px; height: 46px; transform-origin: 50% 40%; animation: cb-plaukia 2.6s ease-in-out infinite; }
#cursor-buddy.kalba .cb-kunas { animation: cb-linkteli .5s ease-out 1, cb-plaukia 2.6s ease-in-out .5s infinite; }
#cursor-buddy .cb-ugnis { transform-origin: 20px 34px; animation: cb-ugnis .16s ease-in-out infinite alternate; }
#cursor-buddy .cb-antena { animation: cb-antena 1.8s ease-in-out infinite; }
#cursor-buddy.kalba .cb-antena { fill: #FFB070; }
#cursor-buddy .cb-mirksi { transform-origin: 20px 18px; animation: cb-mirksi 4.2s infinite; }
#cursor-buddy .cb-akys { transition: transform .12s ease-out; }

@keyframes cb-plaukia { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes cb-linkteli { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-4px) scale(1.06); } 100% { transform: translateY(0) scale(1); } }
@keyframes cb-ugnis { from { transform: scaleY(.78); opacity: .75; } to { transform: scaleY(1.08); opacity: 1; } }
@keyframes cb-antena { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes cb-mirksi { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.12); } }

#cursor-buddy-bubble {
    position: fixed; left: 0; top: 0; z-index: 2147483001; pointer-events: none;
    max-width: 290px; padding: 10px 13px 11px; border-radius: 13px;
    background: rgba(40, 34, 31, .97); border: 1px solid rgba(255, 255, 255, .13);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 0 1px rgba(232, 93, 42, .1);
    color: #ECF0F4; font: 13px/1.45 Inter, system-ui, -apple-system, sans-serif;
    opacity: 0; visibility: hidden; transition: opacity .16s ease, visibility 0s linear .16s;
}
#cursor-buddy-bubble.rodo { opacity: 1; visibility: visible; transition: opacity .16s ease, visibility 0s; }
#cursor-buddy-bubble::before {
    content: ''; position: absolute; top: 16px; left: -6px; width: 10px; height: 10px; transform: rotate(45deg);
    background: rgba(40, 34, 31, .97); border-left: 1px solid rgba(255, 255, 255, .13); border-bottom: 1px solid rgba(255, 255, 255, .13);
}
#cursor-buddy-bubble.kaireje::before { left: auto; right: -6px; border-left: 0; border-bottom: 0; border-right: 1px solid rgba(255, 255, 255, .13); border-top: 1px solid rgba(255, 255, 255, .13); }
/* #997: patarimas virš mygtuko — uodegėlė apačioje dešinėje, rodo žemyn į mygtuką */
#cursor-buddy-bubble.virs::before { top: auto; bottom: -6px; left: auto; right: 34px; border-left: 0; border-top: 0; border-right: 1px solid rgba(255, 255, 255, .13); border-bottom: 1px solid rgba(255, 255, 255, .13); }
#cursor-buddy-bubble .cb-vardas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#cursor-buddy-bubble .cb-vardas b { font-size: 13.5px; font-weight: 700; color: #FFFFFF; }
#cursor-buddy-bubble kbd {
    font: 600 11.5px/1 Inter, system-ui, sans-serif; color: #FFB48F; padding: 3px 7px; border-radius: 6px;
    background: rgba(232, 93, 42, .14); border: 1px solid rgba(232, 93, 42, .35);
}
/* ⌨ #3771 klavišas — atskira eilutė apačioje, klavišai kaip tikri (apatinis kraštas storesnis) */
#cursor-buddy-bubble .cb-klavisas { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 8px; padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, .08); font-size: 11px; color: #95A3B0; }
#cursor-buddy-bubble .cb-klavisas > span { margin-right: 3px; letter-spacing: .02em; }
#cursor-buddy-bubble .cb-klavisas i { font-style: normal; color: #7E8A95; }
#cursor-buddy-bubble .cb-klavisas kbd { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; box-sizing: border-box;
    font: 700 12.5px/1 Inter, system-ui, sans-serif; color: #FFFFFF; border-radius: 7px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05)); border: 1px solid rgba(255, 255, 255, .2); border-bottom-width: 3px;
    box-shadow: 0 0 0 1px rgba(232, 93, 42, .25), 0 4px 10px -4px rgba(0, 0, 0, .6); }
#cursor-buddy-bubble p { margin: 4px 0 0; color: #C9D2DA; }
#cursor-buddy-bubble .cb-vardas + p { margin-top: 5px; }
#cursor-buddy-bubble > p:first-child { margin: 0; color: #ECF0F4; }

/* 💡 patarimas — antraštė oranžinė, kad skirtųsi nuo mygtuko paaiškinimo */
#cursor-buddy-bubble .cb-antraste { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; color: #FFB48F; margin-bottom: 3px; }
#cursor-buddy-bubble.patarimas { border-color: rgba(232, 93, 42, .38); }
#cursor-buddy-bubble.patarimas .cb-vardas { margin-bottom: 1px; }
#cursor-buddy-bubble.patarimas > p { color: #ECF0F4; }

/* 🧭 #1530 klausimas „🤖 Taip, padėk man / Dirbsiu pats / 📖 Pamokos“ — debesėlis spaudžiamas */
#cursor-buddy-bubble.klausia { pointer-events: auto; max-width: 330px; padding: 13px 15px 14px; border-color: rgba(232, 93, 42, .38); }
#cursor-buddy-bubble.klausia .cb-vardas b { font-size: 15px; }
#cursor-buddy-bubble .cb-veiksmai { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#cursor-buddy-bubble .cb-veiksmai button {
    font: 600 12.5px/1 Inter, system-ui, sans-serif; color: #ECF0F4; cursor: pointer; padding: 9px 13px; border-radius: 999px;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16); transition: background .15s ease, border-color .15s ease;
}
#cursor-buddy-bubble .cb-veiksmai button:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); }
#cursor-buddy-bubble .cb-veiksmai button.pirmas { background: #E85D2A; border-color: #E85D2A; color: #fff; }
#cursor-buddy-bubble .cb-veiksmai button.pirmas:hover { background: #F06B3A; }

/* 🤖 #740 apvalus robotuko mygtukas apačioje dešinėje, virš „Pamokos“ (lessons.js #ls-fab: right 76px, 62 px), su užrašu kairėje.
   #758: išjungus mygtukas dingsta (įjungti — ? Pagalba → „🤖 Įjungti robotuką“, help-overlay.js). */
#cb-fab {
    position: fixed; right: 24px; bottom: calc(var(--statusbar-h, 28px) + 18px); z-index: 50;   /* #1534 apvalaus „Pamokos“ nebėra — robotukas kampe; virš scenos, po meniu ir langais */
    display: flex; align-items: center; gap: 10px;
}
body:has(#ls-fab) #cb-fab { bottom: calc(var(--statusbar-h, 28px) + 96px); }
#cb-fab .cb-fab-b {
    width: 50px; height: 50px; border-radius: 50%; padding: 0; cursor: pointer; display: grid; place-items: center;
    background: radial-gradient(circle at 50% 35%, #26313B, #121820 70%); border: 1px solid rgba(111, 224, 255, .45);
    box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .7), 0 0 0 6px rgba(111, 224, 255, .08), 0 0 18px rgba(111, 224, 255, .25);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
}
#cb-fab .cb-fab-b:hover { transform: translateY(-2px) scale(1.06); box-shadow: 0 14px 30px -8px rgba(0, 0, 0, .75), 0 0 0 8px rgba(111, 224, 255, .12), 0 0 24px rgba(111, 224, 255, .4); }
#cb-fab .cb-fab-b svg { display: block; margin-top: 2px; }
#cb-fab.isjungtas { display: none; }
/* 🧭 #1530 „Dirbsiu pats“ — robotukas miega mažame mygtuke (be užrašo), spausk — įsijungs */
#cb-fab.miega .cb-fab-t { display: none; }
#cb-fab.miega .cb-fab-b { transform: scale(.78); opacity: .72; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .7); border-color: rgba(255, 255, 255, .18); }
#cb-fab.miega .cb-fab-b:hover { opacity: 1; transform: scale(.86); }
#cb-fab.miega .cb-mirksi { animation: none; transform: scaleY(.14); }
#cb-fab .cb-fab-t {
    order: -1; padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
    background: rgba(14, 19, 25, .88); border: 1px solid rgba(255, 255, 255, .1); color: #ECF0F4;
    font: 600 12.5px/1 Inter, system-ui, sans-serif; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .6);
}
#cb-fab .cb-fab-t:hover { background: rgba(26, 35, 45, .95); }
#main-menu[style*="flex"] ~ #cb-fab, body:has(#main-menu[style*="flex"]) #cb-fab, body.phone #cb-fab, body.presentation #cb-fab { display: none; }
@media (max-width: 700px) { #cb-fab .cb-fab-t { display: none; } }

/* Dešinės įrankių juostos „Rotate R“ etiketė (editor-ui.js .eui-tip) — kol robotukas įjungtas, jis pasako pats (be dublio) */
html.cb-on .eui-tip { display: none !important; }

/* #748 (vartotojas: „detalę pažymiu, savybių lentelė atsidaro ir jis ant jos“) — atsidarius savybių langui robotuko mygtukas slenka
   kartu su „Pamokos“ ir įrankių juostele (tas pats body.has-properties kaip css/chrome-site.css), lieka virš „Pamokos“ */
@media (min-width: 769px), (pointer: fine) {
    #cb-fab { transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1); }
    body.has-properties #cb-fab { transform: translateX(calc(-1 * var(--properties-w))); }
    body.resizing-properties #cb-fab { transition: none; }
}
/* pranešimai (#toast-stack) — virš robotuko mygtuko, ne ant jo */
body:has(> #cb-fab):not(:has(#main-menu[style*="flex"])) #toast-stack { bottom: calc(var(--statusbar-h, 28px) + 18px + 50px + 14px) !important; }   /* #1534 „Pamokos“ apvalaus nebėra — tik robotuko mygtukas */
/* užrašas — šiltas kaip „Pamokos“ užrašas tamsioje temoje */
:is(html[data-skin] body.theme-dark, body.theme-dark) #cb-fab .cb-fab-t { background: rgba(40, 34, 31, 0.92); border-color: var(--lng-linija, rgba(255, 255, 255, .1)); }
/* #1228 neprisijungus / be plano — robotuko ir jo mygtuko nėra (js/cursor-buddy.js _galima) */
html.cb-nera #cursor-buddy, html.cb-nera #cursor-buddy-bubble, html.cb-nera #cb-fab { display: none !important; }

/* 🤖 #1540 (vartotojas: „robotuko mygtuką prie kitų mygtukų, kad nesimaišytų scenoje“) — dešinės įrankių juostos mygtukas, ne apvalus ant scenos */
#cb-fab.cb-juostoje { position: static; display: block; transform: none !important; transition: none; z-index: auto; }
#cb-fab.cb-juostoje .cb-fab-t { display: none; }
#cb-fab.cb-juostoje .cb-fab-b { width: auto; height: auto; border-radius: inherit; background: none; border: 0; box-shadow: none; display: grid; place-items: center; }
#cb-fab.cb-juostoje .cb-fab-b svg { width: 22px; height: 19px; margin: 0; }
#cb-fab.cb-juostoje .cb-fab-b:hover { transform: none; box-shadow: none; }
#cb-fab.cb-juostoje.miega .cb-fab-b { transform: none; opacity: .55; box-shadow: none; }
#cb-fab.cb-juostoje.miega .cb-fab-b:hover { opacity: 1; transform: none; }
