/* Compartido por el Inicio y el juego (core/pwa.js): modal "Instalá el juego" + aviso de conexión. Fase 9. */
#cg-instalar{position:fixed;inset:0;z-index:10000;background:rgba(0,0,0,.65);display:flex;align-items:flex-end;justify-content:center;padding:0}
#cg-instalar .cg-inst-caja{width:100%;max-width:480px;max-height:90vh;overflow-y:auto;background:#FFF8DC;color:#111;border:4px solid #111;border-bottom:0;border-radius:22px 22px 0 0;
  padding:1.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));text-align:center;font-family:Inter,system-ui,sans-serif;animation:subir .25s ease-out}
@keyframes subir{from{transform:translateY(40px);opacity:0}}
#cg-instalar img{border-radius:14px;border:3px solid #111}
#cg-instalar h3{margin:.5rem 0 .25rem;font-size:22px;font-weight:900}
#cg-instalar p{margin:0 0 .75rem;color:#4f4a3d;font-size:14px}
#cg-instalar ol{text-align:left;margin:0 auto 1rem;padding-left:1.4rem;max-width:340px;font-size:15px;line-height:2}
#cg-instalar .cg-ico{display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;background:#111;color:#FFCC00;border-radius:6px;font-weight:900;vertical-align:middle}
#cg-instalar button{width:100%;min-height:52px;background:#FFCC00;color:#111;font:900 17px Inter,system-ui,sans-serif;border:4px solid #111;border-radius:14px 3px 14px 3px;box-shadow:4px 4px 0 #111;cursor:pointer}
@media (min-width:769px){#cg-instalar{align-items:center}#cg-instalar .cg-inst-caja{border-radius:22px 4px 22px 4px;border-bottom:4px solid #111}}
#cg-red{display:none;position:fixed;top:calc(10px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:10001;background:#B8650A;color:#fff;
  font:800 13px Inter,system-ui,sans-serif;padding:.45rem 1rem;border-radius:999px;border:2px solid #111;pointer-events:none;white-space:nowrap}
#cg-red.ok{background:#1A7A4A}


/* ---- Asistente IA flotante (solo si el admin lo activa) ---- */


#ai-float-btn{position:fixed;left:16px;bottom:calc(16px + env(safe-area-inset-bottom));width:60px;height:60px;border-radius:50%;z-index:997;border:3px solid #111;background:#FFCC00;
  box-shadow:4px 4px 0 #111;padding:0;overflow:hidden;display:flex;align-items:center;justify-content:center}
#ai-float-btn img{width:100%;height:100%;object-fit:cover}
#ai-float-btn svg{width:30px;height:30px}
#ai-chat-panel{position:fixed;left:16px;bottom:calc(90px + env(safe-area-inset-bottom));width:min(340px,calc(100vw - 32px));max-height:min(480px,70vh);z-index:998;display:none;flex-direction:column;
  background:#FFF8DC;color:#111;border:3px solid #111;border-radius:18px 4px 18px 4px;box-shadow:6px 6px 0 #FFCC00;overflow:hidden}
#ai-chat-panel.abierto{display:flex}
#ai-chat-panel header{display:flex;align-items:center;gap:.5rem;padding:.6rem .8rem;background:#111;color:#FFCC00;font-weight:900}
#ai-chat-panel header span{flex:1}
#ai-chat-panel header button{width:44px;height:44px;background:none;border:0;color:#fff;font-size:22px}
#ai-messages{flex:1;overflow-y:auto;padding:.8rem;display:flex;flex-direction:column;gap:.5rem;min-height:160px}
.ai-msg{padding:.5rem .75rem;border-radius:12px;font-size:14px;max-width:85%;white-space:pre-wrap;-webkit-user-select:text;user-select:text}
.ai-msg.user{align-self:flex-end;background:#111;color:#fff}
.ai-msg.assistant{align-self:flex-start;background:#FFF1B8;color:#111}
.ai-msg.error{align-self:flex-start;background:transparent;color:#C0392B;border:2px dashed #C0392B}
#ai-form{display:flex;gap:.5rem;padding:.6rem;border-top:2px solid #FFF1B8}
#ai-input{flex:1;min-width:0;min-height:44px;padding:0 .7rem;border:2px solid #111;border-radius:10px;background:#fff;color:#111;font-size:15px;outline:none}
#ai-form button{min-width:52px;min-height:44px;background:#FFCC00;color:#111;border:3px solid #111;border-radius:10px;font-weight:900}
body.modo-juego #ai-float-btn{display:none!important}
body.modo-juego #ai-chat-panel{z-index:70}
