/* Gema (2.26.0): chat de ayuda flotante, abajo a la derecha. Sustituye al botón de WhatsApp y a la píldora de Discord. */
.bgt-gema { position: fixed; right: 22px; bottom: 22px; z-index: 115; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; font-family: var(--f-body); pointer-events: none; }
.bgt-gema > * { pointer-events: auto; }

/* Botón */
.bgt-gema__btn { position: relative; display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 8px; border: 0; border-radius: 999px; cursor: pointer; color: #1a1004; background: linear-gradient(180deg, #ffc163, var(--orange) 55%, #d98a22); box-shadow: 0 10px 28px -8px #f2a33a99, 0 2px 0 #ffffff55 inset; font: 600 15px/1 var(--f-display); letter-spacing: .02em; overflow: hidden; overflow: clip; transition: padding .35s ease, gap .35s ease, transform .2s ease, box-shadow .2s ease; animation: bgtGemaIn .5s cubic-bezier(.2, .9, .3, 1.2) both .6s; }
.bgt-gema__btn:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -8px #f2a33ab3, 0 2px 0 #ffffff55 inset; }
.bgt-gema__btn:focus-visible { outline: 3px solid var(--cian); outline-offset: 3px; }
.bgt-gema__glyph { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: #ffffff40; }
.bgt-gema__glyph svg { width: 22px; height: 22px; }
.bgt-gema__label { white-space: nowrap; min-width: 0; overflow: hidden; max-width: 260px; opacity: 1; transition: max-width .35s ease, opacity .25s ease; }
.bgt-gema__btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, #ffffff80 48%, transparent 66%); transform: translateX(-120%); animation: bgtGemaShine 1.1s ease-out 1.3s 1 both; pointer-events: none; }
.bgt-gema.is-mini .bgt-gema__btn, .bgt-gema.is-open .bgt-gema__btn { padding: 0 8px; gap: 0; }
.bgt-gema.is-mini .bgt-gema__label, .bgt-gema.is-open .bgt-gema__label { max-width: 0; opacity: 0; }

/* Panel */
.bgt-gema__panel { display: flex; flex-direction: column; width: min(392px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px)); background: var(--panel-2); border: 1px solid var(--line-hi); border-radius: 18px; box-shadow: 0 30px 80px -10px #000d, 0 0 50px -14px #f2a33a40; overflow: hidden; transform-origin: bottom right; animation: bgtGemaCard .22s ease-out both; }
.bgt-gema__panel[hidden] { display: none; }
.bgt-gema__head { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line-hi); background: #0f131c; }
.bgt-gema__av { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: #f2a33a1f; border: 1px solid #f2a33a66; color: var(--orange); }
.bgt-gema__av svg { width: 22px; height: 22px; }
.bgt-gema__who { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.bgt-gema__who b { font: 600 15px/1.2 var(--f-body); color: var(--text); }
.bgt-gema__who b span { font-weight: 500; color: var(--mute); }
.bgt-gema__who small { font-size: 12px; color: var(--mute); }
.bgt-gema__x { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--mute); cursor: pointer; }
.bgt-gema__x svg { width: 20px; height: 20px; }
.bgt-gema__x:hover { background: var(--panel); color: var(--text); }

.bgt-gema__body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bgt-gema__vista { display: flex; flex-direction: column; gap: 12px; }
.bgt-gema__vista[hidden] { display: none; }
.bgt-gema__m { max-width: 86%; font-size: 14px; line-height: 1.5; padding: 11px 14px; border-radius: 14px; white-space: pre-line; overflow-wrap: anywhere; animation: bgtGemaMsg .2s ease-out both; }
.bgt-gema__m--bot { align-self: flex-start; background: #1a2130; color: var(--text); border-radius: 14px 14px 14px 4px; }
.bgt-gema__m--yo { align-self: flex-end; background: var(--orange); color: #1a1004; font-weight: 600; border-radius: 14px 14px 4px 14px; }
.bgt-gema__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; white-space: normal; }
.bgt-gema__lk { font-size: 13px; font-weight: 600; text-decoration: none !important; color: var(--cian) !important; background: #34d1e014; border: 1px solid #34d1e04d; padding: 8px 12px; border-radius: 999px; transition: background .15s ease; }
.bgt-gema__lk:hover, .bgt-gema__lk:focus-visible { background: #34d1e02e; outline: none; }

.bgt-gema__per { align-self: stretch; max-width: none; display: flex; flex-direction: column; gap: 8px; white-space: normal; }
.bgt-gema__op { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-hi); background: var(--panel); color: var(--text) !important; text-decoration: none !important; transition: border-color .15s ease, transform .15s ease; }
.bgt-gema__op:hover, .bgt-gema__op:focus-visible { border-color: var(--cian); transform: translateX(-2px); outline: none; }
.bgt-gema__oi { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; }
.bgt-gema__oi svg { width: 20px; height: 20px; }
.bgt-gema__oi--sop { background: #25d36622; color: #3be27f; }
.bgt-gema__oi--ven { background: #f2a33a22; color: var(--orange); }
.bgt-gema__oi--rem { background: #34d1e022; color: var(--cian); }
.bgt-gema__oi--dc { background: #5865f22e; color: #a9afff; }
.bgt-gema__ot { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bgt-gema__ot b { font-size: 14px; }
.bgt-gema__ot b em { font: 700 10.5px/1 var(--f-display); font-style: normal; text-transform: uppercase; letter-spacing: .06em; color: #06240f; background: #3be27f; border-radius: 5px; padding: 3px 6px; margin-left: 6px; vertical-align: 2px; }
.bgt-gema__ot small { font-size: 12px; color: var(--mute); line-height: 1.35; }

.bgt-gema__k { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin-top: 4px; }
.bgt-gema__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bgt-gema__chip { font: 600 13px/1.2 var(--f-body); color: var(--text); background: #ffffff08; border: 1px solid var(--line-hi); border-radius: 999px; padding: 10px 13px; min-height: 40px; cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.bgt-gema__chip:hover, .bgt-gema__chip:focus-visible { border-color: var(--orange); color: #fff; outline: none; }

.bgt-gema__res { display: flex; flex-direction: column; gap: 4px; text-decoration: none !important; color: var(--text) !important; border: 1px solid var(--line-hi); border-radius: 12px; padding: 12px 14px; transition: background .15s ease, border-color .15s ease; }
.bgt-gema__res:hover, .bgt-gema__res:focus-visible { background: #ffffff0b; border-color: var(--cian); outline: none; }
.bgt-gema__res span { font-size: 11px; color: var(--mute); }
.bgt-gema__res b { font-size: 14px; line-height: 1.3; }
.bgt-gema__res p { margin: 0; font-size: 13px; line-height: 1.45; color: #c9d1de; }
.bgt-gema__res i { font-style: normal; font-size: 13px; font-weight: 600; color: var(--cian); }
.bgt-gema__res mark { background: #f2a33a33; color: inherit; border-radius: 3px; padding: 0 1px; }
.bgt-gema__res--resp { border-color: #f2a33a80; background: #f2a33a0d; cursor: pointer; text-align: left; font: inherit; }
.bgt-gema__nada { background: #1a2130; padding: 14px; border-radius: 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.5; }
.bgt-gema__cta { align-self: flex-start; font: 600 13px/1 var(--f-body); color: #1a1004; background: var(--orange); border: 0; border-radius: 999px; padding: 12px 16px; min-height: 40px; cursor: pointer; }
.bgt-gema__cta:focus-visible { outline: 3px solid var(--cian); outline-offset: 2px; }
.bgt-gema__carga { font-size: 13px; color: var(--mute); }

.bgt-gema__foot { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line-hi); background: #0f131c; margin: 0; }
.bgt-gema__q { position: relative; display: block; }
.bgt-gema__q svg { position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; color: var(--mute); pointer-events: none; }
.bgt-gema__q input { width: 100%; box-sizing: border-box; height: 44px; padding: 0 14px 0 42px; font: 400 14px/1 var(--f-body); color: var(--text); background: #1a2130; border: 1px solid var(--line-hi); border-radius: 12px; -webkit-appearance: none; appearance: none; }
.bgt-gema__q input::placeholder { color: #7d8799; }
.bgt-gema__q input:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: transparent; }
.bgt-gema__foot small { font-size: 11px; color: var(--mute); }

@keyframes bgtGemaIn { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes bgtGemaShine { to { transform: translateX(120%); } }
@keyframes bgtGemaCard { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes bgtGemaMsg { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Móvil: el botón es solo el círculo y el chat ocupa toda la pantalla */
@media (max-width: 640px) {
	.bgt-gema { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
	.bgt-gema__btn { height: 52px; padding: 0 6px; gap: 0; }
	.bgt-gema__glyph { background: transparent; }
	.bgt-gema__glyph svg { width: 26px; height: 26px; }
	.bgt-gema__label { max-width: 0; opacity: 0; }
	.bgt-gema__panel { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; border: 0; z-index: 2; }
	.bgt-gema__foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
	.bgt-gema__q input { font-size: 16px; }   /* sin zoom automático en iPhone */
	.bgt-gema.is-open .bgt-gema__btn { display: none; }
	.bgt-gema.is-open { z-index: 130; }   /* abierta, por encima de la barra de abajo (120) */
}
@media (prefers-reduced-motion: reduce) {
	.bgt-gema__btn, .bgt-gema__panel, .bgt-gema__m { animation: none; }
	.bgt-gema__btn::after { animation: none; display: none; }
}
@media print { .bgt-gema { display: none; } }
