/* «¿Somos mejores? Pregúntale a tu IA»: botón flotante abajo a la derecha que abre el reto. Oscuro en cualquier tramo de la página.
   No depende de otras hojas: trae sus propios colores. */
.vg-reto {
    position: fixed; z-index: 900; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px) + var(--vg-reto-alza, 0px));
    display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #f5f5f7;
    transition: bottom 0.2s;
}
.vg-reto[hidden] { display: none !important; }

/* Píldora cerrada */
.vg-reto-pildora {
    display: flex; align-items: center; background: #0b0d13; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 999px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
}
.vg-reto-abrir {
    display: flex; align-items: center; gap: 11px; padding: 8px 6px 8px 8px; margin: 0;
    background: none; border: 0; color: inherit; cursor: pointer; text-align: left; font: inherit;
}
.vg-reto-icono { flex: none; width: 38px; height: 38px; border-radius: 50%; background: #d21e17; display: grid; place-items: center; }
.vg-reto-icono svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vg-reto-textos { display: grid; gap: 3px; }
.vg-reto-textos small { font: 500 0.64rem/1 "JetBrains Mono", ui-monospace, Consolas, monospace; letter-spacing: 0.14em; text-transform: uppercase; color: #ff5a4f; }
.vg-reto-textos span { font-size: 0.93rem; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.vg-reto-quitar, .vg-reto-x {
    flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; margin: 0 6px 0 2px;
    border: 0; border-radius: 50%; background: transparent; color: rgba(245, 245, 247, 0.58); cursor: pointer;
}
.vg-reto-quitar:hover, .vg-reto-x:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.vg-reto-quitar svg, .vg-reto-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.vg-reto button:focus-visible, .vg-reto a:focus-visible { outline: 2px solid #ff5a4f; outline-offset: 2px; }
.vg-reto-abrir[aria-expanded="true"] .vg-reto-icono { background: #b51711; }

/* Panel abierto */
.vg-reto-panel {
    width: min(390px, calc(100vw - 40px)); max-height: calc(100vh - 140px); overflow-y: auto;
    padding: 20px 20px 16px; background: #0b0d13; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48), inset 0 2px 0 #e5231b;
}
.vg-reto-cabeza { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.vg-reto-cabeza .vg-reto-x { margin: -4px -6px 0 0; }
.vg-reto-ceja { margin: 0 0 8px; font: 500 0.66rem/1 "JetBrains Mono", ui-monospace, Consolas, monospace; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(245, 245, 247, 0.52); }
.vg-reto-titulo { margin: 0; font-size: 1.2rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.vg-reto-titulo em { font-style: normal; color: #ff5a4f; }
.vg-reto-lead { margin: 10px 0 0; font-size: 0.9rem; line-height: 1.5; color: rgba(245, 245, 247, 0.74); }
.vg-reto-pregunta {
    margin: 14px 0 0; padding: 12px 14px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.09);
    font-size: 0.84rem; line-height: 1.5; color: rgba(245, 245, 247, 0.86); overflow-wrap: anywhere;
}
.vg-reto-botones { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vg-reto-ia {
    display: flex; align-items: center; justify-content: center; padding: 10px 10px; border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.24); background: transparent; color: #f5f5f7;
    font-family: inherit; font-size: 0.86rem; font-weight: 600; line-height: 1.2; white-space: nowrap; text-decoration: none; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.vg-reto-ia:hover { border-color: #f5f5f7; }
.vg-reto-ia.primero { grid-column: 1 / -1; background: #d21e17; border-color: #d21e17; color: #fff; }
.vg-reto-ia.primero:hover { background: #b51711; border-color: #b51711; }
.vg-reto-ia.copiar { grid-column: 1 / -1; border-color: transparent; color: rgba(245, 245, 247, 0.7); padding-block: 6px; }
.vg-reto-ia.copiar:hover { color: #fff; }
.vg-reto-estado { margin: 8px 0 0; font-size: 0.84rem; color: #ff5a4f; }
.vg-reto-nota { margin: 10px 0 0; font-size: 0.76rem; line-height: 1.45; color: rgba(245, 245, 247, 0.5); }

@media (max-width: 520px) {
    .vg-reto { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--vg-reto-alza, 0px)); }
    .vg-reto-panel { width: 100%; max-height: calc(100vh - 120px); }
}
@media (max-width: 400px) {
    .vg-reto-ia { white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
    .vg-reto { transition: none; }
}
@media print { .vg-reto { display: none !important; } }
